home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1996 April / Macworld (1996-04).dmg / Shareware World / Entertainment / General / Xconq 7.0.1 / doc / refman.texi (.txt) < prev    next >
Texinfo Document  |  1995-08-22  |  210KB  |  4,901 lines

  1. @node Reference Manual
  2. @chapter Reference Manual
  3. This manual is the complete description of GDL.
  4. The style is somewhat terse; for more detail on how to
  5. use GDL to design games, see Chapter 3.
  6. Please note that the current version of @i{Xconq} may not fully
  7. implement all of the constructs or combinations of constructs
  8. described here.  Any such omissions should be regarded as bugs.
  9. @menu
  10. * Language Syntax::             
  11. * Game Module Forms::                
  12. * World and Area Forms::
  13. * Side and Player Forms::                  
  14. * Unit Forms::                  
  15. * Agreements::                  
  16. * Scorekeeper Forms::                  
  17. * History Forms::                  
  18. * Battle Forms::                  
  19. * Types in General::            
  20. * Unit Types::                  
  21. * Terrain Types::                  
  22. * Material Types::                  
  23. * Static Relationships Between Types::                  
  24. * Vision::                      
  25. * Game Initialization::  
  26. * Synthesis Methods::   
  27. * Setup Postprocessing::        
  28. * Naming and Text Generation::                  
  29. * Actions::          
  30. * Backdrop Environment Parameters::
  31. * Backdrop Economy Parameters::                  
  32. * Random Events::               
  33. * Dates and Time::              
  34. * Image Families::   
  35. * Other Forms::                  
  36. @end menu
  37. @node Language Syntax, Game Module Forms, , Reference Manual
  38. @section Language Syntax
  39. GDL resembles Lisp, but instead of defining functions,
  40. the contents of a file declare
  41. certain objects (such as units and unit types) to exist,
  42. and specify values for their properties.
  43. In other words, GDL is @emph{nonprocedural}.
  44. This means that most of the time, you can list the various
  45. forms in any order you like.
  46. The main restriction is that any symbol, such as a variable
  47. or the name of a type, must be defined before it is used.
  48. Also, forms such as @code{set} and @code{add}, that set the
  49. value of a variable or property,
  50. always overwrite the previous data irreversibly, 
  51. so ordering of these is very important.
  52. @menu
  53. * Lexical Elements::            
  54. * Conventions Used::            
  55. * Forms and Evaluation::        
  56. * Tables::                      
  57. * Modifying Objects::           
  58. * Symbols::                     
  59. * Lists::                       
  60. @end menu
  61. @node Lexical Elements, Conventions Used, Language Syntax, Language Syntax
  62. @subsection Lexical Elements
  63. Numbers are introduced by a decimal digit, plus, or minus signs.
  64. They may contain only decimal digits, a decimal point, and be followed
  65. (immediately, no whitespace allowed) by a percent sign.
  66. Strings are sequences of characters enclosed by doublequotes (@code{"}).
  67. They may contain any character except ASCII NUL (@code{'\0'}).
  68. To include a doublequote, use backslash, as in @code{"a \"quoted\" string"}.
  69. To include a nonprinting or eight-bit character,
  70. use backslash followed by three octal
  71. digits, which will be interpreted as an eight-bit character code.
  72. (This is mostly the same syntax as in C.)
  73. Note that game design files may be passed over networks
  74. and between different kinds of computer systems,
  75. so non-ASCII characters should not be inserted verbatim into strings.
  76. Symbols are sequences of characters that don't
  77. include any of the other special characters.  If you wish to include such
  78. characters in a symbol, enclose it in vertical bars,
  79. for example @code{|foo bar|}.
  80. (The bars are not part of the symbol.)
  81. Symbols are case-sensitive,
  82. but this will be changed eventually.
  83. Lists are a sequence of expressions enclosed in parentheses.
  84. The empty list is either @code{nil} or @code{()}.
  85. ``Dotted pairs'' are not allowed.
  86. Anything that is not a list is an @dfn{atom}.
  87. All of these objects may range up to a very large size.
  88. (You may still run into bugs if you make strings or symbols
  89. over about 100 chars in length.)
  90. Comments are enclosed either within @code{#| |#} (which nests properly,
  91. like Common Lisp and unlike C), or else extend from a semicolon
  92. @code{;} to the end of the line.  A comment is equivalent to whitespace,
  93. so @code{(a#|bcd|#e)} is the same as @code{(a e)}, not @code{(ae)}.
  94. @code{#} by itself is a normal token.
  95. True/false values
  96. are just the integers 0 and 1, with no special characteristics.
  97. @deffn GlobalConstant @code{true}
  98. @end deffn
  99. @deffn GlobalConstant @code{false}
  100. These constants are symbolic forms for @code{1} and @code{0}.
  101. They are identical to numbers,
  102. but more descriptive for parameters that are boolean-valued.
  103. @end deffn
  104. Unit, material, and terrain types are distinct objects.
  105. However, they can be considered to have numeric ``indices''
  106. assigned in order of the types' definition.  These numbers
  107. are not directly visible in GDL, but they often affect sorting
  108. and ordering.
  109. You may also supply numbers as ``dice specs'', which are used in several
  110. tables.  The syntax is the familiar @code{@var{nn}d@var{mm}[+@var{oo}]},
  111. where @var{nn} is the number of dice to throw, @var{mm} is the number of
  112. values on each die, and the optional @var{oo} is an value to be added to
  113. the result.  The die are 0-based, so for instance @code{3d6} yields values
  114. between 0 and 15, while @code{3d6+3} is equivalent to the result of rolling
  115. 3 6-sided dice.  The range of each value is severely limited; @var{nn}
  116. may range from 0 to 7, @var{mm} from 0 to 15, and @var{oo} from 0 to 127.
  117. Internally, dice specs are normal integers, in the range 16384 to 32767.
  118. @node Conventions Used, Forms and Evaluation, Lexical Elements, Language Syntax
  119. @subsection Conventions Used
  120. Descriptions of values in this manual follow the conventions listed here.
  121. For parameters described as @var{t/f},
  122. both @code{1}, @code{0} and @code{true}, @code{false} may be used.
  123. Parameters described as @var{n} and @var{n%} are numbers.
  124. Parameters described as @var{dist} or @var{length}
  125. are also numbers, but are in the unit of measure for lengths.
  126. Parameters described as @var{str} or @var{string} are strings.
  127. Parameters described as
  128. @var{u} or @var{ui}, @var{m} or @var{mi}, and @var{t} or @var{ti},
  129. are values that must be unit, material, or terrain types, respectively.
  130. Parameters described as @var{utype-value-list} match unit types with values.
  131. They can have several forms:
  132. @itemize
  133. @item
  134. @code{(n1 n2 ...)} matches @code{n1} with type 0, etc in order.
  135. @item
  136. @code{((u1 n1) (u2 n2) ...)} evaluates @code{u1} to get a unit type,
  137. then matches it with @code{n1}.  @code{u1} etc may also be a list of
  138. types, in which case all the types get matched with @code{n1}.
  139. @end itemize
  140. Other types of lists, such as those defined as @var{side-value-list},
  141. are interpreted similarly.  For all of these, multiple assignments to
  142. the same type etc will overwrite quietly.
  143. @node Forms and Evaluation, Tables, Conventions Used, Language Syntax
  144. @subsection Forms and Evaluation
  145. A @dfn{form} is either any single expression that appears in the file.
  146. A GDL file consists of a sequence of forms.
  147. Most forms of interest will be lists
  148. whose first element is a symbol identifying the form.
  149. For instance, a form beginning with the symbol @code{side}
  150. declares a side object.
  151. When the file containing such a form is read, @i{Xconq} will
  152. create a side object and fill in any properties as specified by the form.
  153. (Properties are like properties or attributes - most GDL objects
  154. have some.)
  155. In most contexts, @i{Xconq} will @dfn{evaluate} an expression
  156. before using it, such as when filling in an object's property.
  157. Numbers and strings evaluate to themselves, while symbols
  158. evaluate to their bindings, as set by @code{set} or @code{define}.
  159. Lists evaluate to a list of the same length, but with all the elements
  160. evaluated, unless the first element of the list is a function.
  161. In that case,
  162. the remaining elements of the list are evaluated and given to the
  163. function, and its result will be the result.
  164. @node Tables, Modifying Objects, Forms and Evaluation, Language Syntax
  165. @subsection Tables
  166. A @dfn{table} is a two-dimensional array of values indexed by types.
  167. Indices can be any pair of unit, material, or terrain type.
  168. The set of tables is fixed by @i{Xconq}, and all are described below.
  169. @deffn Form @code{table} table-name items@dots{}
  170. This is the general form to fill in a table.
  171. The table named by @var{table-name} is filled in from the @var{items}.
  172. If an item is an atom, then every position in the
  173. table is filled in with that item, overwriting any
  174. previously-specified values.
  175. If an item is a list, it must be a three-element list
  176. of the form @code{(@var{type1} @var{type2} @var{value})}.
  177. If both @var{type1} and @var{type2} are single types,
  178. then @var{value} will be put into the table at the position
  179. indexed by the two types.
  180. If one of @var{type1} or @var{type2} evaluates to a list,
  181. @i{Xconq} will iterate over all members of the list while
  182. keeping the other type constant,
  183. while if both @var{type1} and @var{type2} are lists,
  184. then @i{Xconq} will iterate over all pairs from the two lists.
  185. The values used during iteration depend on whether the @var{value}
  186. is a list.  If @var{value} is an atom, then that value will just
  187. be used on every iteration.  If a list, then @i{Xconq} will
  188. use successive elements of the list while iterating.
  189. If the first member of @var{items} is the symbol @code{add},
  190. then the rest of the items will add to the existing contents
  191. of the table rather than clearing to its default value first.
  192. @end deffn
  193. The following forms are all equivalent:
  194. @example
  195. (table foo (a y 1) (b y 2) (c y 3) (a z 9) (b z 9) (c z 9))
  196. (table foo ((a b c) y (1 2 3)) ((a b c) (z) 9))
  197. (define v1 (a b c))
  198. (table foo (v1 y (1 2 3)) (v1 z 9))
  199. (table foo ((a b c) (y z) ((1 2 3) (9 9 9))))
  200. (table foo (a y 1) (b y 2) (c y 3))
  201. (table foo add ((a b c) z 9))
  202. @end example
  203. @node Modifying Objects, Symbols, Tables, Language Syntax
  204. @subsection Modifying Objects
  205. Since forms normally define or create new objects,
  206. GDL defines the @code{add} form to modify existing objects.
  207. @deffn Form @code{add} objects property new-values@dots{}
  208. This form evaluates the atom or list @var{objects} to arrive at the
  209. set of objects to be modified.
  210. Then it uses the @var{new-values} to write new data into
  211. the property named @var{property} of those objects.
  212. The @var{new-values} may be a single number or string, or a list.
  213. @end deffn
  214. @node Symbols, Lists, Modifying Objects, Language Syntax
  215. @subsection Symbols
  216. Most of the symbols used in a game module are the predefined ones
  217. described in this manual.
  218. Others are attached to types when the types are defined,
  219. and still others name objects like units and sides.
  220. You can also define and set your own symbols to arbitrary values.
  221. @deffn Form @code{define} symbol value
  222. This form defines the symbol @var{symbol} to be bound to the
  223. result of evaluating @var{value}.
  224. If @var{symbol} is already defined, @i{Xconq} will issue a warning,
  225. and ignore this form.
  226. @end deffn
  227. @deffn Form @code{set} symbol value
  228. This form rebinds the already-bound symbol @var{symbol}
  229. to be bound to the result of evaluating @var{value}.
  230. If @var{symbol} is @emph{not} bound already,
  231. then @i{Xconq} will issue a warning, but proceed anyway.
  232. @end deffn
  233. @deffn Form @code{undefine} symbol
  234. This form destroys any binding of the @var{symbol}.
  235. This is allowed for any symbol, including already-unbound symbols.
  236. @end deffn
  237. @node Lists,  , Symbols, Language Syntax
  238. @subsection Lists
  239. @deffn Function @code{quote} xxx@dots{}
  240. This function prevents any evaluation of @var{xxx}.
  241. (This implies that the abovementioned evaluation of the argument
  242. list does @i{not} happen for this ``function''.)
  243. @end deffn
  244. @deffn Function @code{list} xxx@dots{}
  245. This function makes a list out of all the @var{xxx}.
  246. @end deffn
  247. @deffn Function @code{append} xxx@dots{}
  248. This function appends all the @var{xxx} (which may be
  249. lists or not) into a single list.  Non-lists will appear
  250. as though they were single-element lists.
  251. @end deffn
  252. @deffn Function @code{remove} list1 list2
  253. This function removes the members of @var{list1} from @var{list2},
  254. returning the result.
  255. @end deffn
  256. @node Game Module Forms, World and Area Forms, Language Syntax, Reference Manual
  257. @section Game Module Forms
  258. The game module declaration supplies information about the file as a whole.
  259. It is optional; if missing, @i{Xconq} will get the module's
  260. name from its file name, and supply defaults for the other properties.
  261. @deffn Form @code{game-module} [name] properties@dots{}
  262. This form defines the properties of this game module.
  263. The optional @var{name} is a string that will be used to look up
  264. the module in libraries.
  265. If the @var{name} is supplied, then this form is considered to be the
  266. definition of the module, and overwrites any
  267. @code{game-module} form previously appearing in this file.
  268. If @var{name} is missing, then this form will modify the
  269. existing description of the module.
  270. @end deffn
  271. @deffn ModuleProperty @code{title} string
  272. If defined, this property is the name by which the module will be displayed to
  273. players.  It is not used internally, so the name can be modified freely
  274. (unlike the module's name, which may appear in other modules).
  275. Defaults to the module's name. 
  276. @end deffn
  277. @deffn ModuleProperty @code{blurb} string
  278. This property is a one-line description that users will see when they
  279. are deciding whether to play the module.
  280. It will be displayed without any modification:
  281. @example
  282. Welcome to my nightmare! (version 1.0 with stronger goblins)
  283. @end example
  284. Defaults to @code{""}.
  285. @end deffn
  286. @deffn ModuleProperty @code{picture-name} string
  287. This property is the name of a picture that may be displayed along
  288. with the module's blurb, by those interfaces that support such pictures.
  289. Defaults to @code{""}.
  290. @end deffn
  291. @deffn ModuleProperty @code{base-game} t/f
  292. @end deffn
  293. @deffn ModuleProperty @code{instructions} strings@dots{}
  294. This property is a list of strings that are the instructions on how to play
  295. the game.  Defaults to @code{()}.
  296. @end deffn
  297. @deffn ModuleProperty @code{notes} strings@dots{}
  298. This property is a list of strings comprising the set of
  299. detailed player's notes for the module.
  300. Both the list and each string in the list can be of any length.
  301. When displayed, the strings are all concatenated together, so the division
  302. into strings here is just for convenience.
  303. How these are displayed is up to the interface, but in general an empty
  304. string signals a new paragraph.
  305. Defaults to @code{()}.
  306. @end deffn
  307. @deffn ModuleProperty @code{design-notes} strings@dots{}
  308. This property is a list of strings that are notes addressed to game designers.
  309. Defaults to @code{()}.
  310. @end deffn
  311. @deffn ModuleProperty @code{version} string
  312. This property is the version of the module.
  313. Defaults to @code{""},
  314. which indicates that the module's version is undefined.
  315. @end deffn
  316. @deffn ModuleProperty @code{program-version} versions
  317. This property dentifies @i{Xconq} versions for which this module
  318. is appropriate.
  319. If specified, then players will get a warning if they attempt to use this
  320. module with an inappropriate version of @i{Xconq}.
  321. Possible forms include a string, which allows the module only for
  322. exactly matching version of @i{Xconq},
  323. and @code{(@var{comparison} @var{version})},
  324. which allows versions satisfying the @var{comparison} test,
  325. which may only be @code{>=} or @code{<=}.
  326. So for instance
  327. @example
  328. (game-module "foo" (program-version (>= "7.0.3")))
  329. @end example
  330. is claimed to only work for versions 7.0.3 or later.
  331. Defaults to @code{""}, which means that the module is appropriate for
  332. any version of @i{Xconq}.
  333. Notes that the @code{program-version} is strictly a heuristic to forewarn
  334. players; in practice it can be very difficult to know which modules work
  335. with which programs.  (The problems are similar to those encountered
  336. by programmers using different compiler versions on their programs.)
  337. @end deffn
  338. @deffn ModuleProperty @code{base-module} name
  339. This property is the name of a module that must be loaded first.
  340. It is similar in effect to @code{include}.
  341. @end deffn
  342. @deffn ModuleProperty @code{default-base-module} name
  343. This property specifies the name of a module that will be loaded
  344. if this module is given as the ``top-level'' module,
  345. such as via @code{-g} on a command line.
  346. This is to prevent disasters when a library module that is
  347. used only by other modules is instead loaded as if it were
  348. a full game design.
  349. @end deffn
  350. @menu
  351. * Module Variants::                    
  352. * Including Other Modules::     
  353. * Conditional Loading::         
  354. @end menu
  355. @node Module Variants, Including Other Modules, Game Module Forms, Game Module Forms
  356. @subsection Module Variants
  357. Variants are options chosen by players at the start of a game.
  358. A generic variant includes information that will be used for displaying
  359. the choice to players, the acceptable range of choices, a default
  360. choice, and additional forms that may be evaluated if particular
  361. values were chosen.  Variant values are always numbers.
  362. @deffn ModuleProperty @code{variants} items@dots{}
  363. This property defines named variants on this module.
  364. Variants appear as startup options for the game.
  365. The items have the form
  366. @code{([@var{name}] @var{type} [@var{range/default}] [@var{clauses}])}.
  367. The @var{name} is a string or symbol used to identify the choice to
  368. the players, the @var{type} says what sort of change is being enabled,
  369. @var{range/default} supplies a range of values and a default value
  370. among them,
  371. and @var{clauses} is a list of the form @code{(@var{value} @var{forms}@dots{}}.
  372. A game module may specify any number of variants.
  373. Defaults to @code{()}.
  374. @end deffn
  375. A number of commonly useful variant types are predefined.
  376. @deffn VariantType @code{world-size} [ width [ height [ circumf [ lat [ lon ] ] ] ] ] [ clauses ]
  377. This variant allows players to choose the size of the world.
  378. The sizes will default to the values in this variant's data.
  379. (@var{width} and @var{height} can be lists of the form @code{(lo dflt hi)},
  380. with the obvious interpretation??)
  381. @end deffn
  382. @deffn VariantType @code{world-seen} [ dflt ] [ clauses ]
  383. This variant allows players to choose whether
  384. the terrain of the world will be known at the start of the game.
  385. The default setting will be the value @code{dflt},
  386. which may be either @code{true} or @code{false}.
  387. @end deffn
  388. @deffn VariantType @code{see-all} [ dflt ] [ clauses ]
  389. This variant allows players to choose whether everything will be seen
  390. always, as with the global variable @code{see-all}.
  391. The default is set by @code{dflt}.
  392. @end deffn
  393. @deffn VariantType @code{sequential} [ dflt ] [ clauses ]
  394. This variant allows players to choose whether to move
  395. simultaneously during a turn, or one at a time.
  396. The default is set by @var{dflt}.
  397. @end deffn
  398. @deffn VariantType @code{real-time} [ total [ perside [ perturn ] ] ] [ clauses ]
  399. This variant allows players to choose realtime limits on the game.
  400. The value will default to the values in this variant's data.
  401. @c but what about upper/lower limits?
  402. @end deffn
  403. @node Including Other Modules, Conditional Loading, Module Variants, Game Module Forms
  404. @subsection Including Other Modules
  405. You can include one game module in another.
  406. @deffn Form @code{include} [if-needed] module-name [variant-settings]
  407. This form has the effect of inserting the contents
  408. of @var{module-name} into the current position in the module.
  409. @code{game-module} forms in the included module are not inserted,
  410. although they are remembered and may appear in displays.
  411. @i{Xconq} will fail completely if the included module cannot be found.
  412. Unlike C etc, the same module cannot be included more than once; you will
  413. get a warning and the module will not be loaded.
  414. @end deffn
  415. Note that the module names are not file names,
  416. so that system-specific features like directories and devices
  417. cannot be included.
  418. The mapping between module name and file name is interface-specific,
  419. so if you want to distribute a module, you should make sure all the
  420. module names don't have anything nonportable embedded.
  421. Alphanumeric characters and hyphens are guaranteed to be portable.
  422. @node Conditional Loading, , Including Other Modules, Game Module Forms
  423. @subsection Conditional Loading
  424. You can control which forms in a module are actually evaluated
  425. by using conditional loading.
  426. @deffn Form @code{if} test-form sym
  427. @end deffn
  428. @deffn Form @code{else} sym
  429. @end deffn
  430. @deffn Form @code{end-if} sym
  431. If @var{test-form} evaluates to @code{true},
  432. then all subsequent forms, up until the matching @code{else}
  433. or @code{end-if}, will be evaluated.
  434. If @code{false}, then the forms will be read but not evaluated.
  435. All forms inside the conditional must be syntactically correct.
  436. @end deffn
  437. @node World and Area Forms, Side and Player Forms, Game Module Forms, Reference Manual
  438. @section World and Area Forms
  439. The world consists of one @dfn{area},
  440. which is regular in shape and consists of a number of @dfn{cells}.
  441. Each cell has a type of terrain and a number of optional data values.
  442. Each kind of per-cell data will be called a @dfn{layer} of the area.
  443. @deffn Form @code{world} [ circumference ] properties@dots{}
  444. This form defines the properties of the world as a whole.
  445. @end deffn
  446. @deffn Form @code{area} [ width [ height ] ] [ restriction ] properties@dots{}
  447. This form defines the playing area of the world.
  448. The @var{restriction} identifies how to get data for this area from
  449. subsequent forms that are based on larger areas.
  450. @end deffn
  451. @menu
  452. * World Properties::
  453. * Area Properties::
  454. * Layers::                      
  455. * Distances and Elevations::    
  456. * Temperatures::                
  457. * Winds::                       
  458. * Clouds::                      
  459. @end menu
  460. @node World Properties, Area Properties, World and Area Forms, World and Area Forms
  461. @subsection World Properties
  462. @deffn WorldProperty @code{circumference} dist
  463. This property is the distance around the entire world (as a sphere).
  464. Default is @code{360}.
  465. @end deffn
  466. @deffn WorldProperty @code{axial-tilt} n
  467. This property defines the extremes of seasonal changes.
  468. @end deffn
  469. @node Area Properties, Layers, World Properties, World and Area Forms
  470. @subsection Area Properties
  471. @deffn AreaRestriction @code{restrict} w h x y
  472. This is a special subform that specifies that subsequent layers in an
  473. area of size w x h will be offset by x,y and then read into the
  474. actual area.  (This is useful for setting up a game that needs
  475. only a subset of a full map.)
  476. Note that an area restriction is not a property, and must
  477. always appear before any properties in an area form.
  478. @end deffn
  479. @deffn AreaProperty @code{width} n
  480. @end deffn
  481. @deffn AreaProperty @code{height} n
  482. These properties are the width and height of the world,
  483. as measured in cells.
  484. Allowable values range from 3x3
  485. up to 32767x32767, which is one billion cells!
  486. If only one of these is given, then the other defaults to the same value.
  487. If neither has been given, then they default to @code{60} and @code{30},
  488. respectively.
  489. @end deffn
  490. In the case of a cylinder, the world wraps around
  491. in the x direction, and the width is the diameter of the cylinder,
  492. while the height is just the
  493. height in the usual sense.
  494. A hexagon world is flat on the top and bottom; its width is
  495. measured across the middle height, which is the largest span,
  496. and height is the same
  497. as for cylinders.  Here are some crude pictures, first of an 8x6 cylinder:
  498. @example
  499. # # # # # # # #
  500.  : : + + : : : :
  501. : : : + ^ : : :
  502.  : : : : : : : :
  503. : : : : ^ : : :
  504.  # # # # # # # #
  505. @end example
  506. This world is an 8x7 hexagon:
  507. @example
  508.    # # # # # 
  509.   # : + + : #
  510.  # : : + ^ : #
  511. # : : + ^ : : #
  512.  # : : : : : #
  513.   # : : ^ : #
  514.    # # # # # 
  515. @end example
  516. There are two kinds of properties that an area may have:
  517. scalar values such as latitude, 
  518. and layer values such as terrain and elevation.
  519. @deffn AreaProperty @code{latitude} n
  520. This property is the offset, in cells, from the equator of the middle of the area
  521. (height / 2).
  522. Defaults to @code{0}.
  523. @end deffn
  524. @deffn AreaProperty @code{longitude} n
  525. This property is the offset, in cells, from the ``Greenwich Meridian''
  526. of the world.
  527. Defaults to @code{0}.
  528. @end deffn
  529. @node Layers, Distances and Elevations, Area Properties, World and Area Forms
  530. @subsection Layers
  531. @dfn{Layers} constitute the bulk of data about an area of the world.
  532. Each layer assigns a value to each cell in the area;
  533. examples include cell terrain, temperatures, elevations, and so forth.
  534. Since there may be many cells in a layer with the same values,
  535. each layer uses a common run-length encoding scheme.
  536. In this scheme, each horizontal band of cells
  537. is a separate text string, and the contents of the string encode
  538. individual numeric values, one for each cell.
  539. The encoding uses the characters @code{a..~} and @code{:..[}
  540. for 0 through 63,
  541. and decimal digits followed by commas (or the end of the string)
  542. for all other numbers.
  543. An optional @code{-} is allowed, and indicates a negative value.
  544. Runs of constant value are prefixed with their length, in decimal.
  545. The character @code{*} separates run lengths from values expressed
  546. as digits.
  547. Thus, the string
  548. @example
  549. "40adaa100,2*-99"
  550. @end example
  551. represents 46 values in all: 40 zeroes, a three, 2 more zeros, a 100,
  552. and two -99s.
  553. Although this format is quite unreadable,
  554. it has the advantages of compactness and portability;
  555. the expectation is that most layer editing will be done on-line.
  556. Note that the run encoding is entirely optional.
  557. The following subforms at the beginning of layer data have special effects:
  558. @deffn LayerSubform @code{constant} n
  559. This subform causes every value in the layer to be set to @var{n}.
  560. @end deffn
  561. @deffn LayerSubform @code{subarea} x y w h
  562. This subform indicates that the layer data should be positioned at the given
  563. rectangle in the layer.
  564. @end deffn
  565. @deffn LayerSubform @code{xform} mul add
  566. This subform has the effect of first multiplying the raw value by @var{mul},
  567. then adding @var{add} and storing the result into the layer.
  568. @end deffn
  569. @deffn LayerSubform @code{by-bits}
  570. @end deffn
  571. @deffn LayerSubform @code{by-char} str
  572. This subform specifies that the characters in @var{str} give the
  573. encodings of values in the layer.
  574. The first character in @var{str} encodes 0, the second encodes 1,
  575. and so forth.
  576. @end deffn
  577. @deffn LayerSubform @code{by-name} name-list
  578. [what is the syntax of name-list exactly?]
  579. This subform is for generic worlds that are useful across multiple game designs.
  580. The value/name pairs allow for the matching of terrain types by name,
  581. so that if, say,
  582. the ``sea'' terrain type was type #0 in one game and type #4 in another,
  583. the world would have sea in all the same places after it was read in.
  584. In practice, only a few worlds are this general.
  585. If a named terrain type is not present, @i{Xconq} will warn about it
  586. and substitute type 0.
  587. @end deffn
  588. @deffn AreaProperty @code{terrain} layer-data@dots{}
  589. This property is the actual layer of terrain types for cells.
  590. @end deffn
  591. @deffn AreaProperty @code{aux-terrain} terrain-type layer-data@dots{}
  592. This property fills in values for borders, connections, and coatings.
  593. For border and connection terrain,
  594. the value is a six-bit number (0..63),
  595. with a bit turned on in each direction that there is a border
  596. or connection.
  597. For coating types, the value is the depth of the coating.
  598. @end deffn
  599. @deffn AreaProperty @code{features} feature-list layer-data@dots{}
  600. This property specifies the nature and location of all geographical features.
  601. The @var{feature-list} is a list of lists, where each sublist has the form
  602. @code{([@var{id}] @var{typename} @var{name} [@var{super}])}
  603. where @var{id} is the numerical id referenced in the layer data
  604. (defaults to feature's position in the @var{feature-list}),
  605. @var{typename} is a symbol or string giving the general type of feature
  606. (such as @code{bay}),
  607. @var{name} is the name of the feature
  608. (such as @code{"Bay of Bengal"}),
  609. and @var{super} is the optional id of another feature that
  610. incorporates this feature.
  611. @end deffn
  612. @deffn AreaProperty @code{material} material-type layer-data@dots{}
  613. This property declares the quantity of the given @var{material-type}
  614. in each cell of the area.
  615. @end deffn
  616. @deffn AreaProperty @code{people-sides} layer-data@dots{}
  617. This property says which side the people of each cell are on.
  618. A @var{side-encoding} of @code{exact} assigns 0 to independence (no side),
  619. 1 to the first side, and so forth; otherwise, the encoding is a list
  620. of side names/ids and numbers.
  621. @end deffn
  622. @node Distances and Elevations, Temperatures, Layers, World and Area Forms
  623. @subsection Distances and Elevations
  624. @deffn AreaProperty @code{elevations} layer-data@dots{}
  625. This property is the world elevation data itself.
  626. If any elevation falls outside the min/max elevation range
  627. for the terrain type of the cell, then it
  628. will be truncated appropriately.
  629. Defaults to @code{0} for each cell.
  630. @end deffn
  631. @deffn AreaProperty @code{cell-width} dist
  632. This property is the distance across a single cell,
  633. expressed as units of elevation.  Defaults to @code{1}.
  634. @end deffn
  635. @node Temperatures, Winds, Distances and Elevations, World and Area Forms
  636. @subsection Temperatures
  637. Each type of terrain has a temperature range in which it may be found.
  638. Any calculation that would fall outside this range will be clipped.
  639. The temperature can be set to have a given value at a given elevation.
  640. All air temperatures will be interpolated appropriately.
  641. @deffn GlobalVariable @code{temperature-floor} n
  642. This variable is the lowest possible temperature.
  643. Defaults to @code{0}.
  644. @end deffn
  645. @deffn GlobalVariable @code{temperature-floor-elevation} n
  646. This variable is the elevation at which the temperature is always at
  647. @code{temperature-floor}.
  648. Defaults to @code{0}.
  649. @end deffn
  650. @deffn AreaProperty @code{temperatures} layer-data@dots{}
  651. This property contains the temperature data itself.
  652. If any temperature falls outside the min/max temperature range, then it
  653. will be truncated appropriately.
  654. Defaults to @code{0} for each cell.
  655. @end deffn
  656. @node Winds, Clouds, Temperatures, World and Area Forms
  657. @subsection Winds
  658. Winds are defined as having a nonnegative force and a direction.
  659. @deffn AreaProperty @code{winds} layer-data@dots{}
  660. This property contains the force and direction of the prevailing
  661. winds in each cell.
  662. @end deffn
  663. @node Clouds,  , Winds, World and Area Forms
  664. @subsection Clouds
  665. Cloud cover is defined as a layer over the terrain, with
  666. a bottom and top and density for each cell.
  667. @deffn AreaProperty @code{clouds} layer-data@dots{}
  668. This property is the degree of cloud cover over each cell.
  669. A value of @code{0} corresponds to clear skies.
  670. @end deffn
  671. @deffn AreaProperty @code{cloud-bottoms} layer-data@dots{}
  672. This property is the altitude above the ground of the bottoms
  673. of the clouds.
  674. @end deffn
  675. @deffn AreaProperty @code{cloud-heights} layer-data@dots{}
  676. This property is the vertical thickness of the cloud cover
  677. in each cell.
  678. @end deffn
  679. @node Side and Player Forms, Unit Forms, World and Area Forms, Reference Manual
  680. @section Side and Player Forms
  681. @deffn Form @code{side} [id] properties@dots{}
  682. This form has the effect of declaring a side to exist.
  683. If the number or symbol @var{id} is supplied and
  684. matches that of a side that has already been created,
  685. then the properties will modify the pre-existing side.
  686. Otherwise a new side object will be created,
  687. with a arbitrarily-chosen numeric id ranging between 1 and @code{sides-max}.
  688. If the given @var{id} is a symbol, then the side's numeric id will be
  689. bound to that symbol.
  690. @end deffn
  691. @deffn GlobalVariable @code{sides-min} n
  692. @end deffn
  693. @deffn GlobalVariable @code{sides-max} n
  694. These variables are the minimum and maximum number of sides that may exist in
  695. a game.  Defaults are to @code{1} and the internal parameter @code{MAXSIDES},
  696. which is usually around 7.
  697. @code{MAXSIDES} can only be changed by recompiling @i{Xconq}.
  698. @end deffn
  699. @deffn Form @code{side-defaults} properties@dots{}
  700. This form sets the defaults for all newly-created sides declared
  701. subsequently.
  702. These defaults will be set before the new side's properties are interpreted.
  703. This form has no effect on existing sides or on side declarations that
  704. modify existing sides.
  705. @end deffn
  706. @menu
  707. * Side Name Properties::  
  708. * Side Class::                  
  709. * Status in Game::              
  710. * Side Relationships::          
  711. * Numbering Units::             
  712. * Side-Specific Namers::        
  713. * Side Tech Levels::                 
  714. * Side Views::                       
  715. * Interaction::                 
  716. * Doctrine::                    
  717. * Other::                       
  718. * Players::
  719. * Rules of Side Configuration::
  720. @end menu
  721. @node Side Name Properties, Side Class, Side and Player Forms, Side and Player Forms
  722. @subsection Side Name Properties
  723. If the game design allows, all of these properties can be set at startup by
  724. the players (see <side config> and below).
  725. Omission of some of these results in suppression or substitution,
  726. depending on the interface and the situation.
  727. Omission of all name properties allows the side to go unmentioned,
  728. which is useful when the concept of ``side'' is useless or
  729. confusing to a player (as in some adventure games).
  730. All of these properties may be set at any time by any player.
  731. @deffn SideProperty @code{name} str
  732. This property is the proper name of a side, as a country or alliance name.
  733. Examples include @code{"Axis"} and @code{"Hyperborea"}.
  734. Defaults to @code{""}.
  735. @end deffn
  736. @deffn SideProperty @code{long-name} str
  737. This property is the long form of a side's name,
  738. as in @code{"People's Republic of Hyperborea"}.
  739. Defaults to be the same as the side's name.
  740. @end deffn
  741. @deffn SideProperty @code{short-name} str
  742. This property is an short name or acronym for the side,
  743. often just the letters of the long name, as in @code{"PRH"}.
  744. Defaults to @code{""}.
  745. @end deffn
  746. @deffn SideProperty @code{noun} str
  747. This property is the name of an individual unit or person
  748. belonging to the side.
  749. Defaults to @code{""}, which suppresses any mention of the side
  750. when (textually) describing the individual.
  751. @end deffn
  752. @deffn SideProperty @code{plural-noun} str
  753. This property is what you would call a group of individuals.
  754. Defaults to the most common plural form of the @code{noun}
  755. (in English, the default pluralizer adds an ``s''),
  756. so any alternative plural noun, such as @code{"Chinese"},
  757. will need an explicit @code{plural-noun} value.
  758. @end deffn
  759. @deffn SideProperty @code{adjective} str
  760. This property is an adjective that can be used of individuals on the side,
  761. as in @code{"Spanish"}.
  762. Defaults to @code{""}, which suppresses use of the adjective.
  763. @end deffn
  764. As a complete example, a side named @code{"Poland"} would have a long name
  765. @code{"Kingdom of Poland"}, short name @code{"Po"},
  766. noun @code{"Pole"}, plural noun @code{"Poles"},
  767. and adjective @code{"Polish"}.
  768. @deffn SideProperty @code{color} str
  769. This property is a comma-separated list of colors that represents the side.
  770. Defaults to @code{"black"}.
  771. @end deffn
  772. @deffn SideProperty @code{emblem-name} str
  773. This property is the name of a graphical icon that represents the side.
  774. An emblem name of @code{"none"} suppresses any emblem display for the side.
  775. Defaults to @code{""}, which gives the side a randomly-selected emblem.
  776. @end deffn
  777. @deffn SideProperty @code{names-locked} t/f
  778. If the value of this property is @code{true},
  779. then the player cannot modify any of the side's names.
  780. Defaults to @code{false}.
  781. @end deffn
  782. @node Side Class, Status in Game, Side Name Properties, Side and Player Forms
  783. @subsection Side Class
  784. @deffn SideProperty @code{class} str
  785. This property is a side's class, which is a keyword that characterizes the side.
  786. Any number of sides may be in the same class.
  787. Defaults to @code{""}.
  788. @end deffn
  789. @node Status in Game, Side Relationships, Side Class, Side and Player Forms
  790. @subsection Status in Game
  791. Once a side is in the game, it can never be totally removed.
  792. However, sides can become inactive.
  793. @deffn SideProperty @code{active} t/f
  794. This property is @code{true} if the side is still actively participating in the game.
  795. If the side has won, lost, or simply withdrew, this will be @code{false}.
  796. Any units on a side not in the game are effectively frozen statues;
  797. they don't do anything, and are untouchable by anyone else.
  798. Defaults to @code{true}.
  799. @end deffn
  800. @deffn SideProperty @code{status} lose/draw/win
  801. This property tells how this side did in the game.  Defaults to @code{draw}.
  802. @end deffn
  803. @deffn GlobalConstant @code{win}
  804. @end deffn
  805. @deffn GlobalConstant @code{draw}
  806. @end deffn
  807. @deffn GlobalConstant @code{lose}
  808. These constants are the different possible values for a side's status.
  809. @end deffn
  810. @deffn SideProperty @code{advantage} n
  811. @end deffn
  812. @deffn SideProperty @code{advantage-min} n
  813. @end deffn
  814. @deffn SideProperty @code{advantage-max} n
  815. Initial and min/max limits on advantage for the side.
  816. All default to the values of the corresponding global variables.
  817. @end deffn
  818. @node Side Relationships, Numbering Units, Status in Game, Side and Player Forms
  819. @subsection Side Relationships
  820. By default, sides are neutral with respect to each other.
  821. Control is a situation where one side
  822. can observe and move another side's units, but not vice versa.
  823. The controlling side can also just take the units of the controlled side.
  824. If the controlled side loses or resigns, then the controlling side
  825. automatically gets everything.
  826. Both sides must agree to this relationship.
  827. @deffn SideProperty @code{controlled-by} side
  828. This property refers to the side controlling this one.
  829. If 0, then the side is not under control.
  830. Defaults to @code{0}.
  831. @end deffn
  832. The closest side relationship is one of trust.
  833. A trusted side unit's may do anything at any time,
  834. including entering and leaving units on the other side,
  835. consuming the other side's materials, and so forth.
  836. @deffn SideProperty @code{trusts} side-value-list
  837. This property is true for any side that is trusted by this side.
  838. Note that this relationship need not be symmetrical.
  839. Defaults to @code{false} for all sides.
  840. @end deffn
  841. Note that these parameters apply only to relationships as enforced by
  842. @i{Xconq}.  In an actual game, both human and robot sides can make agreements
  843. and have positive/negative opinions about the other sides.
  844. @deffn SideProperty @code{trades} side-value-list
  845. This property defines the trading relationship with other sides.
  846. Defaults to @code{0} for all sides.
  847. @end deffn
  848. @node Numbering Units, Side-Specific Namers, Side Relationships, Side and Player Forms
  849. @subsection Numbering Units
  850. @deffn SideProperty @code{next-numbers} utype-value-list
  851. This property gives the next serial numbers that will be assigned to units
  852. acquired by this side.
  853. Defaults to @code{1} for each unit type (Dijkstra notwithstanding,
  854. that's still where people start numbering things).
  855. @end deffn
  856. If the unit is of a type that gets numbered
  857. (@code{assign-number} property is true),
  858. then any unit of that type, acquired by any means whatsoever,
  859. will be assigned the @code{next-numbers} value for that type
  860. and @code{next-numbers} will be incremented.
  861. @node Side-Specific Namers, Side Tech Levels, Numbering Units, Side and Player Forms
  862. @subsection Side-Specific Namers
  863. A side can have its own set of namers (see below)
  864. that will be used for units
  865. and geographical features associated with that side.
  866. @deffn SideProperty @code{unit-namers} utype-value-list
  867. This property specifies which namers will be used with which types
  868. that the side starts out with or creates new units.
  869. These will not be run automatically on captured units or gifts.
  870. Defaults to @code{""} for each unit type.
  871. @end deffn
  872. @deffn SideProperty @code{feature-namers} feature-type-value-list
  873. This property specifies which namers to use with which geographical
  874. features in the side's initial country (if if has one).
  875. Defaults to @code{()}.
  876. @end deffn
  877. @node Side Tech Levels, Side Views, Side-Specific Namers, Side and Player Forms
  878. @subsection Side Tech Levels
  879. The tech level of a side determines what it can do with each type of unit.
  880. @deffn SideProperty @code{tech} utype-value-list
  881. This property assigns a tech level to each unit type named.
  882. Defaults to @code{0} for each unit type.
  883. @end deffn
  884. @deffn SideProperty @code{init-tech} utype-value-list
  885. This property is the tech level at the beginning of the current turn.
  886. Defaults to @code{0} for each unit type.
  887. @end deffn
  888. @node Side Views, Interaction, Side Tech Levels, Side and Player Forms
  889. @subsection Side Views
  890. These properties are necessary only if the relevant globals
  891. are set a certain way (@code{see-all} is false, etc).
  892. @deffn SideProperty @code{terrain-view} layer-data@dots{}
  893. This property is the side's current knowledge of the world's terrain.
  894. Defaults to @code{()}.
  895. @end deffn
  896. @deffn SideProperty @code{unit-view} layer-data@dots{}
  897. This property is the side's current knowledge of the world.
  898. Defaults to @code{()}.
  899. @end deffn
  900. @deffn SideProperty @code{unit-view-dates} layer-data@dots{}
  901. This property is the turn number at which the unit view data
  902. in the corresponding cell of the @code{unit-view} was set.
  903. Defaults to @code{()}.
  904. @end deffn
  905. @node Interaction, Doctrine, Side Views, Side and Player Forms
  906. @subsection Interaction
  907. @deffn SideProperty @code{turn-time-used} seconds
  908. This property is the number of (real) seconds
  909. that this side has been moving units during the present turn.
  910. Defaults to @code{0}.
  911. @end deffn
  912. @deffn SideProperty @code{total-time-used} seconds
  913. This property is the number of (real) seconds that
  914. this side has been moving units during the course of the game.
  915. Defaults to @code{0}.
  916. @end deffn
  917. @deffn SideProperty @code{timeouts} n
  918. This property is the number of ``time outs'' a side gets for the game.
  919. Defaults to @code{0}.
  920. @end deffn
  921. @deffn SideProperty @code{timeouts-used} n
  922. This property is the number of ``time outs'' a side has already used up.
  923. Defaults to @code{0}.
  924. @end deffn
  925. @deffn SideProperty @code{finished-turn} t/f
  926. This property is true if the side has declared that it is finished moving
  927. things during this turn.
  928. Defaults to @code{false}.
  929. @end deffn
  930. @deffn SideProperty @code{willing-to-draw} t/f
  931. This property is true if the side will go along
  932. with any other side that wants to end the game in a draw.
  933. Defaults to @code{false}.
  934. @end deffn
  935. @node Doctrine, Other, Interaction, Side and Player Forms
  936. @subsection Doctrine
  937. Doctrines are objects that units consult to decide about individual behavior.
  938. @deffn SideProperty @code{doctrines} utype-property-groups@dots{}
  939. This property is the side's unit-type-specific doctrine.
  940. Each @var{utype-property-group} has the form
  941. @code{(@var{unit-types} doctrine)}.
  942. Defaults to @code{()}.
  943. @end deffn
  944. @deffn SideProperty @code{doctrines-locked} t/f
  945. This property says whether the docrine-unit type correspondence
  946. for the side may be altered during the game.
  947. This property does not control whether or not the properties
  948. of the doctrines may be altered.
  949. Defaults to @code{false}.
  950. @end deffn
  951. @deffn SideProperty @code{default-doctrine} doctrine-id
  952. This property is the base doctrine that applies to all unit types
  953. by default.
  954. Defaults to @code{0}.
  955. @end deffn
  956. @deffn Form @code{doctrine} [id] properties@dots{}
  957. This form creates a doctrine with the given id and properties.
  958. @end deffn
  959. @deffn DoctrineProperty @code{ever-ask-side} t/f
  960. This property is the true if the unit may ask the player for what to do,
  961. instead of picking some default activity.
  962. @end deffn
  963. @deffn DoctrineProperty @code{construction-run} type-value-list
  964. This property is the default number of units to build when
  965. construction has been requested.
  966. @end deffn
  967. @deffn DoctrineProperty @code{locked} t/f
  968. This property is true if the properties of the doctrine
  969. cannot be modified by the side's player during the game.
  970. Defaults to @code{false}.
  971. @end deffn
  972. @node Other, Players, Doctrine, Side and Player Forms
  973. @subsection Other
  974. @deffn SideProperty @code{self-unit} unit
  975. This property identifies a unit that represents the side itself.
  976. The value may be a unit id, number, string, or symbol.
  977. Defaults to @code{0}, which means that no unit represents the side.
  978. See below for more details on self units.
  979. @end deffn
  980. @deffn SideProperty @code{priority} n
  981. The order in which the side will get to act, relative to other sides
  982. and to units.
  983. Defaults to @code{0}.
  984. @end deffn
  985. @deffn SideProperty @code{scores} (skid val)@dots{}
  986. This property is the current values of any numeric scores being
  987. kept for the side.  It is a list of pairs of scorekeeper id and value.
  988. Defaults to @code{()}.
  989. @end deffn
  990. @deffn Form @code{independent-units} properties@dots{}
  991. Like the @code{side} form, but sets properties for independent units.
  992. @end deffn
  993. @deffn SideProperty @code{ui-data} data@dots{}
  994. This property contains interface-specific data for the side.
  995. This is mainly for preservation across game save/restores.
  996. The property's value has the form
  997. @code{((interface-type data) (interface-type data) ...)},
  998. so that each interface can maintain its own data separately.
  999. @end deffn
  1000. @deffn SideProperty @code{ai-data} data@dots{}
  1001. This property is information about the AIs associated with a side.
  1002. The property's value has the form
  1003. @code{((ai-type data) (ai-type data) ...)},
  1004. so that each type of AI can maintain its own data separately.
  1005. The form and meaning of each AI's data is specific to it alone.
  1006. Defaults to @code{()}.
  1007. @end deffn
  1008. @node Players, Rules of Side Configuration, Other, Side and Player Forms
  1009. @subsection Players
  1010. Player objects are rarely necessary when building game designs;
  1011. they typically only appear in saved games,
  1012. in order to ensure that the same players get the same sides
  1013. upon restoration.
  1014. @deffn SideProperty @code{player} id
  1015. This property is the unique identifier of a player that is running this side.
  1016. Defaults to @code{0}, which means that no player has been assigned
  1017. to the side.
  1018. @end deffn
  1019. @deffn Form @code{player} [id] properties@dots{}
  1020. This form defines a player.
  1021. If the @var{id} is supplied and matches the id of an existing player,
  1022. then the player object is updated using the @var{properties},
  1023. otherwise a new player object will be created,
  1024. using the given @var{id} if supplied, otherwise creating a new value.
  1025. @end deffn
  1026. @deffn GlobalVariable @code{player-sides-locked} t/f
  1027. This variable is @code{true} if the player/side assignment may not
  1028. be changed while the game is starting up.
  1029. Defaults to @code{false}.
  1030. @end deffn
  1031. The number of players must always be less than the number of sides
  1032. (sides without players just don't do anything).
  1033. @deffn PlayerProperty @code{name} str
  1034. This property identifies the player by name.
  1035. Defaults to @code{""}.
  1036. @end deffn
  1037. @deffn PlayerProperty @code{config-name} str
  1038. This property identifies a particular set of doctrine and other definitions
  1039. that the player is using.
  1040. Defaults to @code{""}.
  1041. @end deffn
  1042. @deffn PlayerProperty @code{display-name} str
  1043. This property identifies the display being used by the player's interface.
  1044. The interpretation of this value is dependent on the interface in use.
  1045. Defaults to @code{""}.
  1046. @end deffn
  1047. @deffn PlayerProperty @code{ai-type-name} str
  1048. This property is the type of AI that will play the side
  1049. if requested or necessary.
  1050. The set of choices depends on what has been compiled into @i{Xconq}.
  1051. (The general-purpose AI type @code{"mplayer"} will usually be available,
  1052. but is not guaranteed.)
  1053. An @code{ai-type-name} of @code{""} means that no AI will run this player.
  1054. Defaults to @code{""}.
  1055. @end deffn
  1056. @deffn PlayerProperty @code{password} str
  1057. This property is the encoding of a password that must be entered before this
  1058. player object can be reused successfully.
  1059. Defaults to @code{""}.
  1060. @end deffn
  1061. @deffn PlayerProperty @code{initial-advantage} n
  1062. This property is an initial relative strength at which the player should start.
  1063. Some synthesis methods can use this to give more units or some other
  1064. advantage to each player according to the requested strength.
  1065. Defaults to @code{1}.
  1066. @end deffn
  1067. @deffn GlobalVariable @code{advantage-min} n
  1068. @end deffn
  1069. @deffn GlobalVariable @code{advantage-max} n
  1070. @end deffn
  1071. @deffn GlobalVariable @code{advantage-default} n
  1072. These variables set the bounds and default values for players'
  1073. initial advantages.
  1074. Default to @code{1}, @code{9999}, and @code{1}, respectively.
  1075. @end deffn
  1076. @i{Xconq} is not guaranteed to be able to be able to set up a game
  1077. with any combination of player advantages;
  1078. the limits depend on the capabilities and characteristics of the
  1079. synthesis methods that use the requested advantages in their
  1080. calculations.
  1081. @node Rules of Side Configuration,  , Players , Side and Player Forms
  1082. @subsection Rules of Side Configuration
  1083. The properties of a side can come from a number of different sources
  1084. (here listed in order of precedence):
  1085. @itemize
  1086. @item
  1087. Interface-specific sources (X resources, Mac preferences).
  1088. @item
  1089. Game-specific form in player's configuration file.
  1090. @item
  1091. Generic form in player's configuration file.
  1092. @item
  1093. The @code{side} form for the side.
  1094. @item
  1095. The @code{side-defaults} form for the game.
  1096. @item
  1097. General program defaults.
  1098. @end itemize
  1099. Note that interface-specific and general config files can never alter
  1100. certain properties of a side, and can only alter others if they are
  1101. not locked.
  1102. @node Unit Forms, Agreements, Side and Player Forms, Reference Manual
  1103. @section Unit Forms
  1104. The basic @code{unit} form creates or modifies a unit.
  1105. @deffn Form @code{unit} id [ type ] properties@dots{}
  1106. This form defines a unit.
  1107. If a numeric @var{id} is supplied and matches the id of an existing unit,
  1108. then that unit will be modified by @var{properties},
  1109. and the optional @var{type} will be interpreted as a new type for the unit.
  1110. Otherwise a new unit will be created,
  1111. with either @var{id} as its id or
  1112. a arbitrarily-selected one if @var{id} is already in use.
  1113. If the unit's id is newly-generated and no type has been specified,
  1114. then type #0 (first-defined type) will be the type of the unit.
  1115. An id of @code{0} can never match an existing unit id, so effect
  1116. will be as if it had been omitted.
  1117. @end deffn
  1118. @deffn Form @var{unit-type-name} x y [ side-id ] properties@dots{}
  1119. This is an abbreviated form, in which
  1120. the x,y position is required, and an optional side id may be included.
  1121. The side id will come from @code{unit-defaults} if not specified.
  1122. The @var{unit-type-name} may be any valid unit type name or
  1123. defined name.
  1124. This form always results in a new unit.
  1125. @end deffn
  1126. Since there may be many units whose properties are similar, there
  1127. is a ``default unit'' whose properties fill in missing properties in
  1128. individual unit declarations.
  1129. @deffn Form @code{unit-defaults} [ modifier ] properties@dots{}
  1130. This form sets the default values for all subsequent units read in,
  1131. in this and every other module not yet loaded.
  1132. The set of defaults is additive,
  1133. so for instance you can repeatedly change the default side of units.
  1134. If the symbol @code{reset} has been supplied for the optional @var{modifier},
  1135. then all the defaults will be changed to the basic default
  1136. values, as described in this manual.
  1137. @end deffn
  1138. @deffn Symbol @code{reset}
  1139. This is the symbol used to reset unit defaults; see above.
  1140. @end deffn
  1141. @menu
  1142. * Unit Properties::             
  1143. * Unit Action State::           
  1144. * Unit Plan::                   
  1145. * Goal Types::                       
  1146. * Task Types::                  
  1147. @end menu
  1148. @node Unit Properties, Unit Action State, Unit Forms, Unit Forms
  1149. @subsection Unit Properties
  1150. This section lists properties of individual units.
  1151. In general, they default to the most common or reasonable values,
  1152. so need not always be specified, even in a saved game.
  1153. @deffn UnitProperty @code{@@} x y [ z ]
  1154. This property is the position of the unit.
  1155. Defaults to @code{-1,-1,0}, which causes the unit to be placed randomly.
  1156. The optional altitude @var{z} can also be set separately with
  1157. the property @code{z} below.
  1158. If @i{z} is even and the unit is in the open,
  1159. then the unit's altitude is @i{z/2};
  1160. if @i{z} is odd, then @i{(z-1)/2} is the type of connection terrain
  1161. that the unit is on.
  1162. @end deffn
  1163. @deffn UnitProperty @code{z} z
  1164. This property is identical to the optional z part of the @code{@@} property. 
  1165. Defaults to @code{0}.
  1166. @end deffn
  1167. @deffn UnitProperty @code{s} side
  1168. This property is the side of the unit.
  1169. It can be either a side name/noun/adjective (string) or id (number).
  1170. A value of @code{0} or @code{"independent"}
  1171. means that the unit is independent.
  1172. Defaults to @code{0}.
  1173. @end deffn
  1174. @deffn UnitProperty @code{os} side
  1175. This property is the original side of the unit.
  1176. It can be either a side name/noun/adjective (string) or id (number).
  1177. A value of @code{0} or @code{"independent"}
  1178. means that the unit is/was originally independent.
  1179. Defaults to the unit's actual side when first read in or created.
  1180. @end deffn
  1181. @deffn UnitProperty @code{#} n
  1182. This property is the unique numeric id of the unit.
  1183. Defaults to a game-selected value.
  1184. @end deffn
  1185. @deffn UnitProperty @code{n} str
  1186. This property is the name of the unit.
  1187. Defaults to @code{""}.
  1188. @end deffn
  1189. @deffn UnitProperty @code{nb} n
  1190. This property is the number of the unit,
  1191. which starts at @code{1} and goes up.
  1192. Defaults to @code{0}, which means that the unit is unnumbered.
  1193. @end deffn
  1194. @deffn UnitProperty @code{cp} n
  1195. This property is the current completeness of the unit.
  1196. If negative, indicates that the unit will appear at a time
  1197. and place specified by the @code{appear} x-property.
  1198. Defaults to the @code{cp-max} for the type.
  1199. @end deffn
  1200. @deffn UnitProperty @code{hp} n
  1201. This property is the current hit points of the unit.
  1202. Will be restricted to the range [0, hp-max].
  1203. An hp of 0 means that the unit is dead and will not appear in the game.
  1204. Defaults to @code{hp-max} for the unit's type.
  1205. @end deffn
  1206. @deffn UnitProperty @code{cxp} cxp
  1207. This property is the combat experience of the unit.
  1208. Defaults to @code{0}.
  1209. @end deffn
  1210. @deffn UnitProperty @code{mo} n
  1211. This property is the morale of the unit.
  1212. Defaults to @code{0}.
  1213. @end deffn
  1214. @deffn UnitProperty @code{m} mtype-value-list
  1215. This property is the amounts of supplies being carried by the unit.
  1216. Defaults to @code{0} for each material type.
  1217. @end deffn
  1218. @deffn UnitProperty @code{tp} utype-value-list
  1219. This property is the level of tooling to build each type of unit.
  1220. Defaults to @code{0} for each unit type.
  1221. @end deffn
  1222. @deffn UnitProperty @code{in} n
  1223. This property is the id of the unit's transport.
  1224. Defaults to @code{0}, meaning that unit is not in any transport.
  1225. @end deffn
  1226. @deffn UnitProperty @code{opinions} side-value-list@dots{}
  1227. This property is the unit's true feelings towards each side,
  1228. including its own side.
  1229. Defaults to @code{0} for each side.
  1230. @end deffn
  1231. @deffn UnitProperty @code{x} obj
  1232. This property is the optional extension properties of the unit.
  1233. Its value may be any object.
  1234. Defaults to @code{()}.
  1235. @end deffn
  1236. @deffn Symbol @code{appear}
  1237. @end deffn
  1238. @deffn Symbol @code{disappear}
  1239. These are extension properties that indicate
  1240. when and where a unit will appear in the game,
  1241. and when it will disappear.
  1242. [syntax?]
  1243. @end deffn
  1244. @node Unit Action State, Unit Plan, Unit Properties, Unit Forms
  1245. @subsection Unit Action State
  1246. @deffn UnitProperty @code{act} subprops
  1247. This property specifies the current action state of the unit.
  1248. @end deffn
  1249. @deffn UnitActionStateProperty @code{acp} n
  1250. This property is the number of action points left to the unit for this turn.
  1251. Defaults to @code{0}.
  1252. @end deffn
  1253. @deffn UnitActionStateProperty @code{acp0} n
  1254. This property is the initial number of action points for this turn,
  1255. computed at the beginning of the turn.
  1256. Defaults to @code{0}.
  1257. @end deffn
  1258. @deffn UnitActionStateProperty @code{aa} n
  1259. This property is the actual number of actions executed by the
  1260. unit so far in the current turn.
  1261. Defaults to @code{0}.
  1262. @end deffn
  1263. @deffn UnitActionStateProperty @code{am} n
  1264. This property is the actual number of moves (cell entries)
  1265. executed so far in the current turn.
  1266. Defaults to @code{0}.
  1267. @end deffn
  1268. @deffn UnitActionStateProperty @code{a} action
  1269. This property is the next action that the unit will perform.
  1270. @end deffn
  1271. Note that if any unit-defining form has an @code{act} property,
  1272. @i{Xconq} will start at an appropriate point in the middle of a turn,
  1273. giving all other units zero acp and mp,
  1274. rather than starting at the beginning of the turn
  1275. and computing acp and mp for all units.
  1276. @node Unit Plan, Goal Types, Unit Action State, Unit Forms
  1277. @subsection Unit Plan
  1278. @deffn UnitProperty @code{plan} type [creation-turn] properties@dots{}
  1279. This property describes the unit's current plan.
  1280. @end deffn
  1281. @deffn PlanType @code{none}
  1282. A unit with this type of plan does nothing.
  1283. It is used when a side has no player.
  1284. @end deffn
  1285. @deffn PlanType @code{passive}
  1286. This plan type is for units on a side that is being run directly
  1287. by the side.
  1288. @end deffn
  1289. @deffn PlanType @code{defensive}
  1290. This plan type is for units that defend areas or other units.
  1291. @end deffn
  1292. @deffn PlanType @code{offensive}
  1293. This plan type is for units that are to be aggressive.
  1294. @end deffn
  1295. @deffn PlanType @code{exploratory}
  1296. This plan type is for units that explore the world.
  1297. @end deffn
  1298. @deffn PlanType @code{random}
  1299. A unit with this plan type will act randomly.
  1300. @end deffn
  1301. @deffn PlanProperty @code{goal} goal
  1302. This property is the main goal of a unit's plan.
  1303. Defaults to @code{()}.
  1304. @end deffn
  1305. @deffn PlanProperty @code{formation} goal
  1306. This property is the formation goal of a unit's plan.
  1307. If defined, it is a position goal that the unit should
  1308. try to achieve when it is not trying to achieve the main goal.
  1309. Defaults to @code{()}.
  1310. @end deffn
  1311. [also support some kind of hook for specific AIs?]
  1312. @deffn PlanProperty @code{tasks} tasks@dots{}
  1313. This property is the complete task agenda for the unit's plan.
  1314. It is a list of tasks.
  1315. Defaults to @code{()}.
  1316. @end deffn
  1317. @deffn PlanProperty @code{asleep} t/f
  1318. This property is true if the unit is asleep.
  1319. Defaults to @code{false}.
  1320. @end deffn
  1321. @deffn PlanProperty @code{reserve} t/f
  1322. This property is true if the unit is in reserve.
  1323. Defaults to @code{false}.
  1324. @end deffn
  1325. @deffn PlanProperty @code{delayed} t/f
  1326. This property is true if the unit's activity
  1327. has been delayed until all others have acted.
  1328. Defaults to @code{false}.
  1329. @end deffn
  1330. @deffn PlanProperty @code{wait} t/f
  1331. This property is true if the unit is waiting for orders.
  1332. Defaults to @code{false}.
  1333. @end deffn
  1334. @deffn PlanProperty @code{ai-control} t/f
  1335. This property is true if the unit can be controlled by
  1336. any AI associated with the side.
  1337. Defaults to @code{true}.
  1338. @end deffn
  1339. @deffn PlanProperty @code{supply-alarm} t/f
  1340. This property is true if the unit should react when supply
  1341. is low.
  1342. Defaults to @code{false}.
  1343. @end deffn
  1344. @deffn PlanProperty @code{supply-is-low} t/f
  1345. This property is true if the unit considers its supply
  1346. to be low.
  1347. Defaults to @code{false}.
  1348. @end deffn
  1349. @deffn PlanProperty @code{wait-transport} t/f
  1350. This property is true if the unit is waiting for transport.
  1351. Defaults to @code{false}.
  1352. @end deffn
  1353. @deffn PlanProperty @code{initial-turn} turn
  1354. This property is the turn upon which a plan should go into effect.
  1355. Defaults to @code{0}.
  1356. @end deffn
  1357. @deffn PlanProperty @code{final-turn} turn
  1358. This property is the turn upon which a plan should be removed.
  1359. If the value is @code{0}, then the plan is not scheduled to
  1360. be removed.
  1361. Defaults to @code{0}.
  1362. @end deffn
  1363. @node Goal Types, Task Types, Unit Plan, Unit Forms
  1364. @subsection Goal Types
  1365. The possible types of goals are these:
  1366. @deffn GoalType @code{no-goal}
  1367. @end deffn
  1368. @deffn GoalType @code{won-game}
  1369. @end deffn
  1370. @deffn GoalType @code{lost-game}
  1371. @end deffn
  1372. @deffn GoalType @code{world-is-known}
  1373. @end deffn
  1374. @deffn GoalType @code{vicinity-is-known}
  1375. @end deffn
  1376. @deffn GoalType @code{positions-known}
  1377. @end deffn
  1378. @deffn GoalType @code{cell-is-occupied}
  1379. @end deffn
  1380. @deffn GoalType @code{vicinity-is-held}
  1381. @end deffn
  1382. @deffn GoalType @code{has-unit-type}
  1383. @end deffn
  1384. @deffn GoalType @code{has-unit-type-near}
  1385. @end deffn
  1386. @deffn GoalType @code{has-material-type}
  1387. @end deffn
  1388. @deffn GoalType @code{keep-formation}
  1389. @end deffn
  1390. @node Task Types,  , Goal Types, Unit Forms
  1391. @subsection Task Types
  1392. The possible types of tasks are these:
  1393. @deffn TaskType @code{build} u n n2 unit-id
  1394. This type of task directs the unit to build @var{n} units
  1395. of type @var{u}.  @var{n2} is the number already built
  1396. in the run and @var{unit-id} is the (optional) id of a
  1397. unit already being built.
  1398. @end deffn
  1399. @deffn TaskType @code{capture} unit-id
  1400. @end deffn
  1401. @deffn TaskType @code{disband}
  1402. This type of task directs the unit to disband itself.
  1403. @end deffn
  1404. @deffn TaskType @code{do-action} n action
  1405. @end deffn
  1406. @deffn TaskType @code{hit-position} x y z
  1407. @end deffn
  1408. @deffn TaskType @code{hit-unit} unit-id
  1409. @end deffn
  1410. @deffn TaskType @code{move-dir} dir
  1411. @end deffn
  1412. @deffn TaskType @code{move-to} x y z dist
  1413. This type of task directs the unit to move to a distance of
  1414. no more than @code{dist} cells from the given location.
  1415. @end deffn
  1416. @deffn TaskType @code{occupy} unit
  1417. @end deffn
  1418. @deffn TaskType @code{pickup} unit
  1419. @end deffn
  1420. @deffn TaskType @code{repair} unit
  1421. @end deffn
  1422. @deffn TaskType @code{resupply}
  1423. @end deffn
  1424. @deffn TaskType @code{sentry} n
  1425. This task type directs the unit to stay where it is for
  1426. the next @var{n} turns.
  1427. @end deffn
  1428. @node Agreements, Scorekeeper Forms, Unit Forms, Reference Manual
  1429. @section Agreements
  1430. @deffn Form @code{agreement} [name/id] properties@dots{}
  1431. This form defines an agreement among a set of sides.
  1432. The name/id is a unique internal identifier.
  1433. @end deffn
  1434. @deffn AgreementProperty @code{type-name} str
  1435. This property is the name of the general type of agreement,
  1436. such a trade.
  1437. Defaults to @code{""}.
  1438. @end deffn
  1439. @deffn AgreementProperty @code{title} str
  1440. This property is the player-visible name of the agreement.
  1441. Defaults to @code{""}.
  1442. @end deffn
  1443. @deffn AgreementProperty @code{terms} forms@dots{}
  1444. This property is the list of terms of the agreement.
  1445. Defaults to @code{()}.
  1446. @end deffn
  1447. @deffn AgreementProperty @code{drafters} side-list
  1448. This property is the side that initially proposed the agreement.
  1449. @end deffn
  1450. @deffn AgreementProperty @code{proposers} side-list
  1451. This property is the side that initially proposed the agreement.
  1452. @end deffn
  1453. @deffn AgreementProperty @code{signers} side-list
  1454. Before the agreement is made,
  1455. this property is the proposed list of participants.
  1456. After the agreeement is made,
  1457. this is the actual list of participants.
  1458. @end deffn
  1459. @deffn AgreementProperty @code{willing-to-sign} side-list
  1460. This property is all the sides that have already agreed to this agreement,
  1461. on condition that all the other sides accept it.
  1462. @end deffn
  1463. @deffn AgreementProperty @code{known-to} side-list
  1464. @end deffn
  1465. @deffn AgreementProperty @code{enforcement} form
  1466. @end deffn
  1467. [include values such as @code{enforced} and @code{publicity}?]
  1468. @deffn AgreementProperty @code{state} state
  1469. @end deffn
  1470. [add symbols for states]
  1471. @node Scorekeeper Forms, History Forms, Agreements, Reference Manual
  1472. @section Scorekeeper Forms
  1473. Scorekeepers are the objects that manage scoring, winning, and losing.
  1474. A game design need not define any scorekeepers,
  1475. and none are created by default.
  1476. A scorekeeper may either maintain a numeric score that is used at
  1477. the end of the game to decide rankings, or simply declare a side
  1478. to have won or lost.
  1479. @deffn Form @code{scorekeeper} name properties@dots{}
  1480. This form creates or modifies a scorekeeper with the given @var{name},
  1481. with the given @var{properties}.
  1482. @end deffn
  1483. @menu
  1484. * Scorekeeper Properties::
  1485. * Scorekeeper Bodies::                      
  1486. * Scorekeeper Functions::       
  1487. * Scorefile::                   
  1488. @end menu
  1489. @node Scorekeeper Properties, Scorekeeper Bodies, , Scorekeeper Forms
  1490. @subsection Scorekeeper Properties
  1491. @deffn ScorekeeperProperty @code{title} str
  1492. This property is a string that identifies the scorekeeper to the players.
  1493. Defaults to @code{""}.
  1494. @end deffn
  1495. @deffn ScorekeeperProperty @code{when} (type [exp])
  1496. This property is when the scorekeeper will be checked or updated.
  1497. Defaults to @code{after-turn}.
  1498. @end deffn
  1499. @deffn ScorekeeperWhenType @code{before-turn} exp
  1500. This indicates that the scorekeeper will run at the start of each turn
  1501. matching @var{exp}, or after every turn if @var{exp} is not given.
  1502. @end deffn
  1503. @deffn ScorekeeperWhenType @code{after-turn} exp
  1504. This indicates that the scorekeeper will run at the end of each turn
  1505. matching @var{exp}, or after every turn if @var{exp} is not given.
  1506. @end deffn
  1507. @deffn ScorekeeperWhenType @code{after-event} exp
  1508. This indicates that the scorekeeper will run after every event
  1509. matching @var{exp}, or after every event if @var{exp} is not given.
  1510. @end deffn
  1511. @deffn ScorekeeperWhenType @code{after-action} exp
  1512. This indicates that the scorekeeper will run at the end of each action
  1513. matching @var{exp}, or after every action if @var{exp} is not given.
  1514. @end deffn
  1515. @deffn ScorekeeperProperty @code{applies-to} side-list
  1516. This property is the set of sides or side classes
  1517. to which the scorekeeper applies.
  1518. Scorekeepers apply only to sides that are in the game.
  1519. Defaults to @code{side*}. 
  1520. @end deffn
  1521. @deffn ScorekeeperProperty @code{known-to} side-list
  1522. This property is the list of sides that know about this scorekeeper,
  1523. and can see the value of the score for each side that it applies to.
  1524. Defaults to @code{side*}. 
  1525. @end deffn
  1526. @deffn ScorekeeperProperty @code{trigger} form
  1527. This property is an expression that is true when it is time
  1528. to start checking the scorekeeper's main test.
  1529. Once a scorekeeper is triggered, it remains active.
  1530. Defaults to @code{false}.
  1531. @end deffn
  1532. @deffn ScorekeeperProperty @code{triggered} t/f
  1533. This property is true if the scorekeeper is currently triggered.
  1534. Defaults to @code{true}.
  1535. @end deffn
  1536. @deffn ScorekeeperProperty @code{do} forms@dots{}
  1537. This property is a list of forms to execute in order
  1538. each time the scorekeeper runs.
  1539. Defaults to @code{()}.
  1540. @end deffn
  1541. @deffn ScorekeeperProperty @code{messages} forms@dots{}
  1542. This property is a list of messages to be sent [???].
  1543. Defaults to @code{()}.
  1544. @end deffn
  1545. @deffn ScorekeeperProperty @code{initial} value
  1546. This property is the value of the score upon game startup.
  1547. If this value is @code{-9999},
  1548. the scorekeeper does not maintain a numeric score.
  1549. Defaults to @code{-9999}.
  1550. @end deffn
  1551. @node Scorekeeper Bodies, Scorekeeper Functions, Scorekeeper Properties, Scorekeeper Forms
  1552. @subsection Scorekeeper Bodies
  1553. The forms in the body (the @code{do} property) of the scorekeeper
  1554. may be any of the forms listed here.
  1555. @deffn ScorekeeperForm @code{last-side-wins}
  1556. If supplied as the only symbol in the body, then the scorekeeper
  1557. implements the usual ``last side left in the game wins'' behavior.
  1558. @end deffn
  1559. @deffn ScorekeeperForm @code{if} test action
  1560. If the @i{test} evaluates to @code{true} or any nonzero number,
  1561. then the @i{action} will be done.
  1562. @end deffn
  1563. @deffn ScorekeeperForm @code{cond} (test actions@dots{}) @dots{}
  1564. This is like Lisp's cond.
  1565. @end deffn
  1566. @deffn ScorekeeperForm @code{stop} [message]
  1567. This stops the game immediately, with a draw for all sides.
  1568. @end deffn
  1569. @deffn ScorekeeperForm @code{win} [sides] [own-message] [other-message]
  1570. @end deffn
  1571. @deffn ScorekeeperForm @code{lose} [sides] [own-message] [other-message]
  1572. @end deffn
  1573. @deffn ScorekeeperForm @code{end} [message]
  1574. This scorekeeper action ends the game immediately.
  1575. @end deffn
  1576. @deffn ScorekeeperForm @code{add} exp [side]
  1577. This adds the result of evaluating @var{exp} to the score of the given side.
  1578. The value may be a negative number.
  1579. @end deffn
  1580. @node Scorekeeper Functions, Scorefile, Scorekeeper Bodies, Scorekeeper Forms
  1581. @subsection Scorekeeper Functions
  1582. @deffn ScorekeeperFunction @code{and} exps
  1583. @end deffn
  1584. @deffn ScorekeeperFunction @code{or} exps
  1585. @end deffn
  1586. @deffn ScorekeeperFunction @code{not} exp
  1587. @end deffn
  1588. @deffn ScorekeeperFunction @code{=} exp1 exp2
  1589. @end deffn
  1590. @deffn ScorekeeperFunction @code{/=} exp1 exp2
  1591. @end deffn
  1592. @deffn ScorekeeperFunction @code{>} exp1 exp2
  1593. @end deffn
  1594. @deffn ScorekeeperFunction @code{>=} exp1 exp2
  1595. @end deffn
  1596. @deffn ScorekeeperFunction @code{<} exp1 exp2
  1597. @end deffn
  1598. @deffn ScorekeeperFunction @code{<=} exp1 exp2
  1599. @end deffn
  1600. @deffn ScorekeeperFunction @code{sum} types properties [test]
  1601. @end deffn
  1602. @node Scorefile,  , Scorekeeper Functions, Scorekeeper Forms
  1603. @subsection Scorefile
  1604. @deffn GlobalVariable @code{scorefile-name} str
  1605. This variable supplies the name of the file to be used for recording
  1606. scores of people playing the game.
  1607. The default value is @code{""}, which disables the recording of scores.
  1608. @end deffn
  1609. @c [scorefile must include xconq version, module(s) plus versions,
  1610. @c player/side setup, dates/times, and list of scores/values plus
  1611. @c optional id as to which is which]
  1612. @node History Forms, Battle Forms, Scorekeeper Forms, Reference Manual
  1613. @section History Forms
  1614. All the important events in a game are logged into a history.
  1615. @deffn Form @code{evt} date type sides data
  1616. This form creates a single historical event.
  1617. The @var{date} is the turn of the event's occurrence, while
  1618. the @var{sides} is a bit mask of sides that know about the
  1619. event, or @code{all} if all sides know about it.
  1620. @end deffn
  1621. @deffn GlobalConstant @code{all}
  1622. @end deffn
  1623. @deffn Form @code{exu} id type x y side props
  1624. This form defines an ``ex-unit'', which is a record of a unit that
  1625. existed previously.  It is similar to a unit, but has only a few
  1626. properties; type, id, position, side, name, and number.
  1627. Property names and semantics are nearly identical to their
  1628. counterparts for units.
  1629. @end deffn
  1630. @deffn EventType @code{log-started}
  1631. This event records when the recording of events began.
  1632. Multiple instances of this may occur, for instance if
  1633. logging were to be turned off and then on again.
  1634. @end deffn
  1635. @deffn EventType @code{log-ended}
  1636. @end deffn
  1637. @deffn EventType @code{game-started}
  1638. This event records the actual start of the game.
  1639. There should only be one in a game's history.
  1640. @end deffn
  1641. @deffn EventType @code{game-saved}
  1642. This event records that the game was saved.
  1643. @end deffn
  1644. @deffn EventType @code{game-restarted}
  1645. This event records that the game was restored and restarted from
  1646. a saved game.
  1647. @end deffn
  1648. @deffn EventType @code{game-ended}
  1649. @end deffn
  1650. @deffn EventType @code{side-joined} side
  1651. This event records when a side joined the game.
  1652. @end deffn
  1653. @deffn EventType @code{side-lost} side scorekeeper
  1654. This event records when a side lost.
  1655. @end deffn
  1656. @deffn EventType @code{side-won} side scorekeeper
  1657. This event records when a side won.
  1658. @end deffn
  1659. @deffn EventType @code{side-withdrew} side
  1660. This event records when a side withdrew from the game.
  1661. @end deffn
  1662. @deffn EventType @code{unit-created} side unit
  1663. This event records the creation of a unit.
  1664. @end deffn
  1665. @deffn EventType @code{unit-completed} side unit
  1666. This event records the completion of a unit.
  1667. @end deffn
  1668. @deffn EventType @code{unit-acquired}
  1669. This event records the acquisition of a unit,
  1670. for instance as a gift from another side.
  1671. @end deffn
  1672. @deffn EventType @code{unit-captured}
  1673. This event records the capture of a unit,
  1674. as an outcome of combat or from a direct attempt to capture.
  1675. @end deffn
  1676. @deffn EventType @code{unit-moved} unit x1 y1 x2 y2
  1677. This event records the movement of a unit.
  1678. @end deffn
  1679. @deffn EventType @code{unit-name-changed} unit1 unit2
  1680. This event records that a unit's name was changed.
  1681. @var{unit1} will be an ex-unit representing the unit
  1682. under its previous name.
  1683. @end deffn
  1684. @deffn EventType @code{unit-type-changed} unit1 unit2
  1685. This event records that a unit's type was changed.
  1686. @var{unit1} will be an ex-unit representing the unit
  1687. with its previous type.
  1688. @end deffn
  1689. @deffn EventType @code{unit-assaulted} unit1 unit2 x y
  1690. @end deffn
  1691. @deffn EventType @code{unit-damaged} unit hp1 hp2
  1692. @end deffn
  1693. @deffn EventType @code{unit-killed} unit
  1694. @end deffn
  1695. @deffn EventType @code{unit-vanished} unit
  1696. @end deffn
  1697. @deffn EventType @code{unit-wrecked} unit
  1698. @end deffn
  1699. @deffn EventType @code{unit-garrisoned} unit
  1700. @end deffn
  1701. @deffn EventType @code{unit-disbanded} unit
  1702. @end deffn
  1703. @deffn EventType @code{unit-starved} unit
  1704. @end deffn
  1705. @deffn EventType @code{unit-left-world} unit
  1706. @end deffn
  1707. The following event types are the results of actions.
  1708. @deffn EventType @code{action-ok}
  1709. @end deffn
  1710. @deffn EventType @code{action-error}
  1711. @end deffn
  1712. @deffn EventType @code{cannot-do}
  1713. @end deffn
  1714. @deffn EventType @code{insufficient-acp}
  1715. @end deffn
  1716. @deffn EventType @code{insufficient-material}
  1717. @end deffn
  1718. @deffn EventType @code{too-far}
  1719. @end deffn
  1720. @deffn EventType @code{too-near}
  1721. @end deffn
  1722. @deffn EventType @code{action-done}
  1723. @end deffn
  1724. @deffn EventType @code{insufficient-mp}
  1725. @end deffn
  1726. @deffn EventType @code{cannot-leave-world}
  1727. @end deffn
  1728. @deffn EventType @code{destination-full}
  1729. @end deffn
  1730. @deffn EventType @code{overrun-succeeded}
  1731. @end deffn
  1732. @deffn EventType @code{overrun-failed}
  1733. @end deffn
  1734. @deffn EventType @code{capture-succeeded}
  1735. @end deffn
  1736. @deffn EventType @code{capture-failed}
  1737. @end deffn
  1738. @deffn EventType @code{fire-into-outside-world}
  1739. @end deffn
  1740. @deffn EventType @code{zz-log-head}
  1741. An administrative event that should never be written out nor read in.
  1742. @end deffn
  1743. @node Battle Forms, Types in General, History Forms, Reference Manual
  1744. @section Battle Forms
  1745. Battles always have exactly two ``sides'', referred to as
  1746. the attacker-list or A-list and the defender-list or D-list, so
  1747. as not to confuse them with sides in the game.
  1748. @deffn Form @code{battle} a-list d-list@dots{}
  1749. @end deffn
  1750. Each list has the form
  1751. @example
  1752. ((<unit> <commitment>) ...)
  1753. @end example
  1754. @node Types in General, Unit Types, Battle Forms, Reference Manual
  1755. @section Types in General
  1756. Types are the foundation of @i{Xconq} game designs.
  1757. Nearly all the rules and game parameters are associated
  1758. with the unit, material, and terrain types.
  1759. There is no sort of type hierarchy; instead, most forms allow sets of types
  1760. to be used in the place of single types.
  1761. Each type has an index associated with it, starting from 0.
  1762. This index never appears directly, and cannot be set.
  1763. This does mean that types have an order, so the order in which
  1764. types are defined is sometimes significant.
  1765. These cases will be noted.
  1766. The order is always the order in which the types appear in the file.
  1767. @menu
  1768. * Type Names::                      
  1769. * Type Images::                     
  1770. * Documentation::               
  1771. * Availability::                
  1772. * Type Extension::              
  1773. @end menu
  1774. @node Type Names, Type Images, Types in General, Types in General
  1775. @subsection Type Names
  1776. The names of types need not be distinct from each other,
  1777. but you run the risk of player confusion if they share names.
  1778. @deffn TypeProperty @code{name} string
  1779. This property is the specific name of the type.
  1780. This name will be displayed to players; the exact format
  1781. is up to the interface, but will typically
  1782. depend on the name's length and the space available in the display.
  1783. If no type names have been defined, the internal type name (see below)
  1784. will be used.
  1785. Defaults to @code{""}.
  1786. @end deffn
  1787. @deffn TypeProperty @code{long-name} string
  1788. This property is a fully spelled-out name for the type.
  1789. Defaults to @code{""}.
  1790. @end deffn
  1791. @deffn TypeProperty @code{short-name} string
  1792. This property is an abbreviated name of r
  1793. Defaults to @code{""}.
  1794. @end deffn
  1795. @deffn TypeProperty @code{generic-name} string
  1796. This property is like @code{name}, but identifies the type less specifically,
  1797. and several types may have the same generic name.
  1798. If no generic names are defined, then the regular type names will be used.
  1799. This is useful when making abbreviated lists, so that related types
  1800. get counted together.
  1801. Defaults to @code{()}.
  1802. @end deffn
  1803. As an example of the distinction between type names and generic type name,
  1804. the names of a automobile type might be @code{"1965 Mustang"},
  1805. @code{"Mustang"}, and @code{"M"},
  1806. while the generic name is @code{"auto"}.
  1807. Then the interface could choose to display a parking lot as containing
  1808. either @code{"4 auto"} or @code{"2 Mustang 1 Edsel 1 Jeep"}.
  1809. Note that names specified as properties are strings only, and are
  1810. not defined as evaluable symbols.
  1811. @node Type Images, Documentation, Type Names, Types in General
  1812. @subsection Type Images
  1813. The interpretation of these properties is entirely up to each interface;
  1814. see the appropriate interface documentation for details.
  1815. @deffn TypeProperty @code{image-name} str
  1816. This property is the name of the type's image.
  1817. If undefined or unusable for some reason,
  1818. the interface will display the type in some default manner, such as
  1819. a solid-color square or a string.
  1820. @end deffn
  1821. For example, in X11,
  1822. the name might be the name of a file in the usual bitmap format, as
  1823. produced by the @var{bitmap} program.  The actual file name is produced
  1824. by appending @code{".b"}.
  1825. (The situation in X is actually more complicated than this.)
  1826. See the interface documentation for details on how the interface
  1827. uses the image.
  1828. @deffn TypeProperty @code{color} str
  1829. This property is the name of the preferred color for this type.
  1830. Both normal color names and the strings @code{"bg"} and @code{"fg"}
  1831. (meaning ``foreground color'' and ``background color'')
  1832. may be used.
  1833. If the image is in color, then this property has no effect.
  1834. Defaults to @code{"fg"}.
  1835. @end deffn
  1836. @deffn TypeProperty @code{char} str
  1837. This property supplies a single character for this type
  1838. (all characters after the first one in @var{str} are ignored).
  1839. Defaults to @code{""}.
  1840. @end deffn
  1841. @node Documentation, Availability, Type Images, Types in General
  1842. @subsection Documentation
  1843. @deffn TypeProperty @code{description-format} list@dots{}
  1844. This property defines the different ways in which
  1845. an instance or instances of this type may be described textually.
  1846. This information may be used in narrative descriptions and by some
  1847. interfaces.
  1848. [describe syntax of the lists - are similar to name grammars]
  1849. If @code{()}, then the instance will be described in some default
  1850. fashion, such as (for units) @code{"the <side> <ordinal> <type>"}.
  1851. Defaults to @code{()}.
  1852. @end deffn
  1853. @deffn TypeProperty @code{help} string
  1854. This property is a brief (preferably one-line) description of the type.
  1855. Defaults to @code{""}.
  1856. @end deffn
  1857. @deffn TypeProperty @code{notes} strings@dots{}
  1858. This property is detailed documentation about the type. 
  1859. The formatting of the strings is up to the interface,
  1860. but in general each string is a separate line,
  1861. the string @code{""} indicates a line break,
  1862. and two @code{""} in a row indicates a paragraph break.
  1863. Defaults to @code{()}.
  1864. @end deffn
  1865. @node Availability, Type Extension, Documentation, Types in General
  1866. @subsection Availability
  1867. It may be that a set of types is larger than strictly necessary for
  1868. a particular game.  You can make any type unavailable, which means
  1869. that irrespective of any other controls, that type cannot come into
  1870. play during a game.  You can also make it available only for particular
  1871. turns.
  1872. @deffn TypeProperty @code{available} n
  1873. If the value of this property is greater than 0, then this type is available
  1874. in the game on or after turn @var{n}.
  1875. If the value is less than 0, then the type is available,
  1876. but only until turn @var{-n}.
  1877. If the value is 0, then the type is never available.
  1878. Defaults to @code{1}, which means that the type is always available.
  1879. @end deffn
  1880. If a type becomes unavailable and there are units of that type in play,
  1881. then they will vanish immediately.
  1882. @node Type Extension, , Availability, Types in General
  1883. @subsection Type Extension
  1884. It may occasionally be necessary to add new kinds of
  1885. information to a type.
  1886. For instance, new synthesis methods may require special data,
  1887. or an interface may be able to use extra hints to improve its display.
  1888. The @code{extensions} property can be used to store this kind of data.
  1889. @deffn TypeProperty @code{extensions} properties@dots{}
  1890. This property is a catch-all for nonstandard type properties.
  1891. Anything may appear here, but it will only be interpreted as much as needed,
  1892. and unrecognized extensions will not be warned about (so if you misspell
  1893. one, you won't find out).
  1894. @end deffn
  1895. @node Unit Types, Terrain Types, Types in General, Reference Manual
  1896. @section Unit Types
  1897. @deffn Form @code{unit-type} symbol properties@dots{}
  1898. This form defines a new type of unit.
  1899. The @var{symbol} is required and must be previously undefined.
  1900. The bindings in @var{properties} are then added to the type one by one.
  1901. If no other name properties are defined, the @var{symbol} may be displayed
  1902. to players (see above).
  1903. You can define no more than 126 types of units.
  1904. @end deffn
  1905. The @var{symbol} here becomes the unit type's ``internal type name''
  1906. which is guaranteed unique.
  1907. To make synonyms for the internal type name, use @code{define}.
  1908. @deffn GlobalVariable @code{u*}
  1909. This variable evaluates to a list of all unit types,
  1910. listed in the order that they were defined.
  1911. This list always reflects the list of types at the moment it is evaluated.
  1912. @end deffn
  1913. @deffn GlobalVariable @code{non-unit}
  1914. This variable [constant?] evaluates to a value that is NOT a unit type.
  1915. This is needed in several places to enable/disable features.
  1916. Use of this in any other way is an error,
  1917. and may or may not be detected before it causes a crash.
  1918. @end deffn
  1919. @menu
  1920. * Unit Naming::                 
  1921. * Class-Restricted Unit Types::  
  1922. * Self-Unit Capable Units::                  
  1923. * Limits on Unit Quantities::    
  1924. * Hit Points::                  
  1925. * Experience::                  
  1926. * Tech Levels vs Units::                 
  1927. * Opinions::                    
  1928. * Point Value::                 
  1929. @end menu
  1930. @node Unit Naming, Class-Restricted Unit Types, Unit Types, Unit Types
  1931. @subsection Unit Naming
  1932. @deffn UnitTypeProperty @code{namer} namer-id
  1933. This property is the namer that will be used to generate names for units,
  1934. if the unit's side does not have a namer, or the unit is
  1935. independent and not in any country.
  1936. Defaults to @code{0}, which leaves the unit unnamed.
  1937. @end deffn
  1938. @deffn UnitTypeProperty @code{assign-number} t/f
  1939. This property is true if the unit should have a serial number assigned to it
  1940. by the side it belongs to.
  1941. Serial numbers are maintained for each type on each side separately,
  1942. start at 1 for the first unit of the type, and increase by one each time.
  1943. Defaults to @code{true}.
  1944. @end deffn
  1945. @node Class-Restricted Unit Types, Self-Unit Capable Units, Unit Naming, Unit Types
  1946. @subsection Class-Restricted Unit Types
  1947. Sometimes the designer will want to make different sides have different types
  1948. of units.  Although this can be done by setting up scenarios appropriately,
  1949. that won't close all the loopholes that might allow a side to get units that
  1950. should only ever belong to another side.
  1951. The first step is to define a class for each side.  For instance,
  1952. a side named @code{"Rome"} might have a class @code{"Roman"},
  1953. while the sides named @code{"Aedui"} and @code{"Parisii"}
  1954. could both be in the class @code{"barbarian"}.
  1955. @deffn UnitTypeProperty @code{possible-sides} exp
  1956. This property restricts the unit type to only be usable
  1957. by a side meeting the conditions of @var{exp}.
  1958. If @var{exp} is a string, it restricts the unit type to only
  1959. be usable by a side whose class includes a matching string.
  1960. This can also be a boolean combination.
  1961. Independent units belong to a side whose class is @code{"independent"}.
  1962. The default of @code{""} allows the unit to belong to any side.
  1963. @end deffn
  1964. @node Self-Unit Capable Units, Limits on Unit Quantities, Class-Restricted Unit Types, Unit Types
  1965. @subsection Self-Unit Capable Units
  1966. The self-unit can be any type, including one that cannot act;
  1967. for instance, a capital city could be the self-unit, thus making
  1968. its defense all-important for a player.
  1969. @deffn GlobalVariable @code{self-required} t/f
  1970. This variable is true if each side is required to have a self-unit
  1971. at all times.
  1972. However, if no unit of a suitable type is available when the game begins,
  1973. then none will be required.
  1974. Defaults to @code{false}.
  1975. [this should also have a related side property?]
  1976. [rounding-down advantage should not eliminate one needed as self-unit?]
  1977. @end deffn
  1978. @deffn UnitTypeProperty @code{can-be-self} t/f
  1979. This property says that the type of unit can represent the side directly.
  1980. Defaults to @code{false}.
  1981. @end deffn
  1982. @deffn UnitTypeProperty @code{self-changeable} t/f
  1983. This property is true if the player can choose to change a self-unit of
  1984. this type at any time.
  1985. Otherwise the self-unit can be changed only if the current one dies.
  1986. Defaults to @code{false}.
  1987. @end deffn
  1988. @deffn UnitTypeProperty @code{self-resurrects} t/f
  1989. This property is true if when the self-unit dies, another unit of an allowable type
  1990. becomes the self-unit automatically.
  1991. Defaults to @code{false}.
  1992. @end deffn
  1993. Observe that these parameters can be used to develop various forms of
  1994. backup, so that a player can start out as a capital city, resurrect as
  1995. a town, change self to one of several towns, then lose when all the towns
  1996. are lost.
  1997. @deffn UnitTypeProperty @code{direct-control} t/f
  1998. This property is true if a unit of this type can be controlled by its side
  1999. automatically.
  2000. If false, then it must be within range of a unit that can control it,
  2001. and is itself under control by the side.
  2002. Defaults to @code{true}.
  2003. @end deffn
  2004. @deffn Table @code{control-chance-at} u1 u2 -> n%
  2005. @end deffn
  2006. @deffn Table @code{control-chance-adjacent} u1 u2 -> n%
  2007. @end deffn
  2008. @deffn Table @code{control-chance} u1 u2 -> n%
  2009. @end deffn
  2010. @deffn Table @code{control-range} u1 u2 -> dist
  2011. This table gives the maximum distance from self-unit @var{u1}
  2012. at which units of type @var{u2}
  2013. can be controlled directly.  Units further away always act on their own
  2014. (as if the doctrine said so[?]).
  2015. If this value is < 0, then @var{u1} can never directly control
  2016. any other @var{u2} on the side.
  2017. Defaults to @code{infinity}.
  2018. @end deffn
  2019. @node Limits on Unit Quantities, Hit Points, Self-Unit Capable Units, Unit Types
  2020. @subsection Limits on Unit Quantities
  2021. The effect of these is
  2022. to prevent any extra units from being created or from going over to a
  2023. side, regardless of the reason.
  2024. This happens by either preventing player actions that would
  2025. result in exceeding a limit (such as when building units), or by making
  2026. the unit vanish instantly (such as when capturing a unit).
  2027. @deffn GlobalVariable @code{units-in-game-max} n
  2028. This variable is the maximum number of all types of units, on all sides,
  2029. including independents, that may exist at any time, including initially.
  2030. Defaults to @code{-1}, which means that there is no limit.
  2031. @end deffn
  2032. @deffn GlobalVariable @code{units-per-side-max} n
  2033. This variable is the maximum number of units (of all types together) 
  2034. that any side may have, at any time.  Events that would cause
  2035. the limit to be exceeded, such as capturing a unit, result in
  2036. either the unit vanishing or becoming independent.
  2037. Defaults to @code{-1}, which means that there is no limit.
  2038. @end deffn
  2039. There is no limit on the number of units that may be independent.
  2040. @deffn UnitTypeProperty @code{type-in-game-max} n
  2041. This property is the maximum total of the given type, for all sides together.
  2042. Defaults to @code{-1}, which means that there is no limit.
  2043. @end deffn
  2044. @deffn UnitTypeProperty @code{type-per-side-max} n
  2045. This property is the maximum number of units of the given type allowed to each side.
  2046. Defaults to @code{-1}, which means that there is no limit.
  2047. @end deffn
  2048. @node Hit Points, Experience, Limits on Unit Quantities, Unit Types
  2049. @subsection Hit Points
  2050. A unit's hit points determine how healthy it is.
  2051. If a unit's hp goes below 1, it is either @dfn{wrecked},
  2052. meaning that it changes to a new type
  2053. @code{wrecked-type} or else it @dfn{vanishes},
  2054. meaning that it is completely cleared from the world.
  2055. @deffn UnitTypeProperty @code{hp-max} n
  2056. This property is the maximum number of hit points for (each part of) a unit.
  2057. Completed units start with this many hit points.
  2058. Defaults to @code{1}.
  2059. @end deffn
  2060. @deffn UnitTypeProperty @code{parts-max} n
  2061. This property declares that a unit is really
  2062. an aggregate of @var{n} smaller identical units.
  2063. Defaults to @code{1}.
  2064. @end deffn
  2065. @deffn UnitTypeProperty @code{wrecked-type} unit-type
  2066. This property is the type of unit that a unit with 0 hp will become.
  2067. For instance, a destroyed ``fort'' might become a ``rubble pile'' unit.
  2068. If its value is @code{non-unit}, then the destroyed unit just vanishes.
  2069. The @code{wrecked-type} of a type must be a different type.
  2070. Defaults to @code{non-unit}.
  2071. @end deffn
  2072. The transformation to the wrecked type does not change position or name.
  2073. The transformed unit has full hp, supplies are conserved as much as possible,
  2074. tooling is preserved, and any unit plan is erased.
  2075. It has the same number of parts, or as many as possible if that is fewer.
  2076. It may be that the
  2077. wrecked type is on terrain that it cannot survive on; in that case, it
  2078. will be wrecked again, repeating until the unit either vanishes
  2079. or is in a viable position, or this process has been repeated
  2080. more times than the number of unit types (prevents infinite loops).
  2081. Any excess occupants will be removed and either placed in another nearby
  2082. unit or in the open, or will vanish if there is no other option.
  2083. @deffn UnitTypeProperty @code{hp-recovery} n
  2084. This property is the number of 1/100 hp recovered per turn.
  2085. Recovery happens automatically at the end of each turn.
  2086. The amount @i{n} / 100 is recovered automatically each turn,
  2087. while @i{n} mod 100 is the percent chance of recovering 
  2088. an additional 1 hit point.
  2089. Defaults to @code{0}.
  2090. @end deffn
  2091. @node Experience, Tech Levels vs Units, Hit Points, Unit Types
  2092. @subsection Experience
  2093. @deffn UnitTypeProperty @code{cxp-max} cxp
  2094. This property is the maximum combat experience this type of unit can have.
  2095. Defaults to @code{0}.
  2096. @end deffn
  2097. @node Tech Levels vs Units, Opinions, Experience, Unit Types
  2098. @subsection Tech Levels vs Units
  2099. Before it can do anything with a type of unit,
  2100. the side must have the appropriate tech level for that type,
  2101. which is just a number ranging from 0 up to @code{tech-level-max}.
  2102. Each type has a distinct tech level.
  2103. Tech levels always increase
  2104. (since they represent abstract knowledge rather than physical plant).
  2105. Tech can be transferred freely to any other side
  2106. via the message @code{tech} [xref to messages].
  2107. For each unit type, the following parameters define the minimum tech levels at
  2108. which sides can do various things.
  2109. @deffn UnitTypeProperty @code{tech-to-see} tl
  2110. This property is the minimum tech level that a side must have before it can see
  2111. a unit of this type.
  2112. Defaults to @code{0}.
  2113. @end deffn
  2114. @deffn UnitTypeProperty @code{tech-to-own} tl
  2115. This property is the minimum tech level
  2116. that a side must have in order to have a unit of this type.
  2117. Defaults to @code{0}.
  2118. @end deffn
  2119. @deffn UnitTypeProperty @code{tech-from-ownership} tl
  2120. This property is the tech level that may be reached
  2121. by acquiring a unit of this type.
  2122. Since this is expressed as a minimum,
  2123. multiple acquisitions have no additional effect.
  2124. Defaults to @code{0}.
  2125. @end deffn
  2126. @deffn UnitTypeProperty @code{tech-to-use} tl
  2127. This property is the minimum tech level that a side must have in order to
  2128. give actions to this type of unit.
  2129. Defaults to @code{0}.
  2130. @end deffn
  2131. @deffn UnitTypeProperty @code{tech-to-build} tl
  2132. This property is the minimum tech level that a side
  2133. must have in order to build this type of unit.
  2134. Defaults to @code{0}.
  2135. @end deffn
  2136. @deffn UnitTypeProperty @code{tech-max} tl
  2137. This property is the absolute maximum tech level possible for this type.
  2138. Defaults to @code{0}.
  2139. @end deffn
  2140. @deffn Table @code{tech-crossover} u1 u2 -> n%
  2141. This table is the minimum tech level for @var{u2} that is guaranteed by a particular
  2142. tech level for @var{u1}, expressed as a percentage of the @code{tech-max}
  2143. for the types.
  2144. For instance, if @code{tech-crossover} is 80, and the tech level for @var{u1}
  2145. is 10 out of a max of 20, and the max for @var{u2} is also 20,
  2146. then the side has a tech for @var{u2} at least 8.
  2147. Defaults to @code{0}.
  2148. @end deffn
  2149. It is possible to gain some tech level just by being in the same game
  2150. with a side that is more advanced.
  2151. @deffn UnitTypeProperty @code{tech-leakage} .01tl
  2152. This property is the amount of tech level gain per turn that can happen
  2153. to any side's tech level that is less than the max of all sides in the game.
  2154. This only happens if at least one unit on the side has nonzero coverage
  2155. of a unit on a more advanced side.
  2156. Defaults to @code{0}.
  2157. @end deffn
  2158. @node Opinions, Point Value, Tech Levels vs Units, Unit Types
  2159. @subsection Opinions
  2160. @deffn UnitTypeProperty @code{has-opinions} t/f
  2161. This property is true if the unit has opinions about sides,
  2162. both other sides and its own.
  2163. Defaults to @code{false}.
  2164. @end deffn
  2165. @node Point Value, , Opinions, Unit Types
  2166. @subsection Point Value
  2167. Point values provide an abstract way to characterize the overall importance
  2168. of a unit type.
  2169. Point values figure into some scorekeepers, and are used by AIs.
  2170. @deffn UnitTypeProperty @code{point-value} n
  2171. This property is the ``value'' of a unit.
  2172. Defaults to @code{1}.
  2173. @end deffn
  2174. @node Terrain Types, Material Types, Unit Types, Reference Manual
  2175. @section Terrain Types
  2176. Terrain types are associated with the cells, borders,
  2177. connections, and coatings in a world.
  2178. @deffn Form @code{terrain-type} name properties@dots{}
  2179. This form defines a new type of terrain, named by @var{name}.
  2180. Details are similar to those for unit types.
  2181. @end deffn
  2182. @deffn GlobalVariable @code{t*}
  2183. This variable evaluates to a list of all terrain types,
  2184. listed in the order that they were defined.
  2185. @end deffn
  2186. @deffn GlobalVariable @code{non-terrain}
  2187. This variable has a value that is guaranteed not to be a terrain type.
  2188. @end deffn
  2189. @menu
  2190. * Terrain Subtypes::            
  2191. * Terrain Compatibility::       
  2192. * Other Terrain Properties::    
  2193. * People::                      
  2194. @end menu
  2195. @node Terrain Subtypes, Terrain Compatibility, Terrain Types, Terrain Types
  2196. @subsection Terrain Subtypes
  2197. Terrain can appear in four different roles: as the interior of
  2198. a cell, as a border between cells, as a connection between cells,
  2199. or as a coating overlaying the normal terrain.
  2200. The terrain subtype says which role a type can play.
  2201. @deffn TerrainTypeProperty @code{subtype} subtype
  2202. This property is the role that the terrain type can appear in.
  2203. Defaults to @code{cell}.
  2204. @end deffn
  2205. @deffn GlobalConstant @code{cell}
  2206. This constant indicates that terrain can fill a cell.
  2207. All units in the open and with an altitude of 0 are assumed
  2208. to be surrounded by the cell terrain.
  2209. @end deffn
  2210. @deffn GlobalConstant @code{border}
  2211. This constant indicates that the terrain can be a border.
  2212. @end deffn
  2213. @deffn GlobalConstant @code{connection}
  2214. This constant indicates that the terrain can be a connection.
  2215. @end deffn
  2216. @deffn GlobalConstant @code{coating}
  2217. This constant indicates that the terrain can be a coating.
  2218. A @dfn{coating} is a temporary terrain modification.
  2219. The classic example is snow,
  2220. which effectively changes some kinds of terrain,
  2221. but not completely and usually not permanently.
  2222. Cells can have varying heaviness of each type of coating.
  2223. @end deffn
  2224. @deffn Table @code{coating-depth-min} t1 t2 -> n
  2225. In order for a coating @var{t1} to ``stick'',
  2226. this table says much must be added all at once to terrain @var{t2}.
  2227. A coating depth that drops below this will disappear immediately.
  2228. Defaults to @code{0}.
  2229. @end deffn
  2230. @deffn Table @code{coating-depth-max} t1 t2 -> n
  2231. This table is the upper limit on coating depth.
  2232. Defaults to @code{0}.
  2233. @end deffn
  2234. Terrain types may have additional subtype attributes that
  2235. are used only during synthesis, to select appropriate subtypes
  2236. for special purposes.
  2237. @deffn TerrainTypeProperty @code{subtype-x} n
  2238. This property is extra subtype information, used in synthesis.
  2239. Defaults to @code{no-x}.
  2240. @end deffn
  2241. @deffn GlobalConstant @code{no-x}
  2242. @end deffn
  2243. @deffn GlobalConstant @code{river-x}
  2244. This constant indicates that synthesis methods should treat this
  2245. type as a river.
  2246. The terrain type may be either a border or a connection.
  2247. @end deffn
  2248. @deffn GlobalConstant @code{valley-x}
  2249. This constant indicates that synthesis methods should treat this type
  2250. as a valley.
  2251. @end deffn
  2252. @deffn GlobalConstant @code{road-x}
  2253. This constant indicates that synthesis methods should treat this type
  2254. as a road.
  2255. @end deffn
  2256. @deffn TerrainTypeProperty @code{liquid} t/f
  2257. This property is true if the terrain type represents a liquid,
  2258. which means that adjacent cells of liquid must have the same elevation.
  2259. Defaults to @code{false}.
  2260. @end deffn
  2261. @node Terrain Compatibility, Other Terrain Properties, Terrain Subtypes, Terrain Types
  2262. @subsection Terrain Compatibility
  2263. Terrain types are not always mutually compatible.
  2264. Incompatible types may not be juxtaposed, either at
  2265. game setup time or by unit action during a game.
  2266. @deffn Table @code{adjacent-terrain-effect} t1 t2 -> t3
  2267. This table specifies what will happen to a cell of type @var{t1}
  2268. adjacent to a cell of type @var{t2}.  If @var{t3} is @code{non-terrain},
  2269. nothing will happen, otherwise it will become a cell of type @var{t3}.
  2270. If @var{t1} is a border type adjacent to a cell of type @var{t2}.
  2271. If @var{t3} is @code{non-terrain}, nothing will happen.
  2272. Otherwise, the border of type @var{t1} will be removed,
  2273. and if @var{t3} is a border type, a border of that type will be added.
  2274. The effect on connection types is analogous.
  2275. Defaults to @code{non-terrain}.
  2276. @end deffn
  2277. @node Other Terrain Properties, , Terrain Compatibility, Terrain Types
  2278. @subsection Other Terrain Properties
  2279. @deffn TerrainTypeProperty @code{elevation-min} dist
  2280. @end deffn
  2281. @deffn TerrainTypeProperty @code{elevation-max} dist
  2282. These properties define the minimum and maximum possible values
  2283. for the elevation in a cell of given terrain type.
  2284. Both default to @code{0}.
  2285. @end deffn
  2286. @deffn TerrainTypeProperty @code{temperature-min} n
  2287. @end deffn
  2288. @deffn TerrainTypeProperty @code{temperature-max} n
  2289. These properties define the minimum and maximum possible values
  2290. for the temperature in a cell of given terrain type.
  2291. Both default to @code{0}.
  2292. @end deffn
  2293. @deffn TerrainTypeProperty @code{wind-force-min} n
  2294. @end deffn
  2295. @deffn TerrainTypeProperty @code{wind-force-max} n
  2296. These properties define limits on wind force.
  2297. Both default to @code{0}.
  2298. @end deffn
  2299. @deffn TerrainTypeProperty @code{clouds-min} n
  2300. @end deffn
  2301. @deffn TerrainTypeProperty @code{clouds-max} n
  2302. These properties define limits on cloud density.
  2303. Both default to @code{0}.
  2304. @end deffn
  2305. @node Material Types, Static Relationships Between Types, Terrain Types, Reference Manual
  2306. @section Material Types
  2307. Materials are materials that are manipulated in mass quantities.
  2308. In general, material types just index vectors of values attached
  2309. to other objects, such as unit supplies.
  2310. No more than 126 types of material may be defined.
  2311. @deffn Form @code{material-type} symbol properties@dots{}
  2312. This form defines a new type of material, named by @var{symbol}.
  2313. Details are similar to those for unit types.
  2314. @end deffn
  2315. @deffn GlobalVariable @code{m*}
  2316. This variable evaluates to a list of all material types,
  2317. listed in the same order as they were defined.
  2318. @end deffn
  2319. @deffn GlobalVariable @code{non-material}
  2320. This variable has a value that is never a material type.
  2321. @end deffn
  2322. @menu
  2323. * People::
  2324. @end menu
  2325. @node People, , , Material Types
  2326. @subsection People
  2327. A material type can be designated as representing people.
  2328. @deffn MaterialTypeProperty @code{people} n
  2329. This property is the actual number of individuals
  2330. represented by 1 of a material.
  2331. If 0, then the material type does not have people associated with it at all.
  2332. Defaults to @code{0}.
  2333. @end deffn
  2334. Multiple types of materials can represent different types of people,
  2335. so for example there could be one type @code{nomad} with 10 people/material,
  2336. and another type @code{urbanite} with 10,000 people/material.
  2337. The basic cell capacities for materials also constrain people
  2338. materials. There can be an additional limit on the number of individuals.
  2339. @deffn TerrainTypeProperty @code{people-max} n
  2340. This property is the maximum number of individuals allowed
  2341. in a cell of this type of terrain.
  2342. This is checked at the end of each turn;
  2343. any excess will be moved into adjacent cells or disappear entirely.
  2344. Defaults to @code{-1}, which allows any number of people in a cell.
  2345. @end deffn
  2346. @node Static Relationships Between Types, Vision, Material Types, Reference Manual
  2347. @section Static Relationships Between Types
  2348. In general, static relationships are those that must always hold
  2349. during a turn.  @i{Xconq} will usually only test these when
  2350. necessary, but this is up to the implementation.
  2351. From the players' and designers' point of view, these relationships
  2352. can never be violated, even temporarily.
  2353. @menu
  2354. * Occupants and Transports::    
  2355. * Units and Terrain::           
  2356. * Units and Materials::         
  2357. * Terrain and Materials::       
  2358. @end menu
  2359. @node Occupants and Transports, Units and Terrain, , Static Relationships Between Types
  2360. @subsection Occupants and Transports
  2361. A unit inside another unit is an ``occupant'' in a ``transport'',
  2362. even if the ``transport'' can never move.
  2363. There are two kinds of capacity.  Generic capacity is shared by
  2364. all different types, while guaranteed capacity is for a particular
  2365. type only.
  2366. @deffn UnitTypeProperty @code{capacity} n
  2367. This property is the limit on the sum of sizes of units that may occupy this
  2368. type of unit, not counting the exclusive capacities.
  2369. Defaults to @code{0}.
  2370. @end deffn
  2371. @deffn Table @code{unit-size-as-occupant} u1 u2 -> n
  2372. This table is the ``size'' of a (full-sized) unit @var{u1} when it is in
  2373. a transport @var{u2}.
  2374. Defaults to @code{1}.
  2375. @end deffn
  2376. @deffn Table @code{unit-capacity-x} u1 u2 -> n
  2377. This table is the number of units of type @var{u2} that are guaranteed
  2378. a place in a unit of type @var{u1}.
  2379. Defaults to @code{0}.
  2380. @end deffn
  2381. @deffn Table @code{occupant-max} u1 u2 -> n
  2382. This table is the upper limit on the number of occupants of this type
  2383. (not counting @code{unit-capacity-x}).
  2384. Defaults to @code{0}.
  2385. @end deffn
  2386. @deffn UnitTypeProperty @code{occupant-total-max} n
  2387. This property is the upper limit on occupants of all types together.
  2388. Defaults to @code{-1}, which allows unlimited occupancy.
  2389. @end deffn
  2390. A unit that is an occupant may not always have the same capabilities
  2391. as when it is out in the open.  Its vision, combat, construction, and
  2392. capacity may be affected.
  2393. @deffn Table @code{occupant-vision} u1 u2 -> t/f
  2394. Defaults to @code{true}.
  2395. @end deffn
  2396. @deffn Table @code{occupant-combat} u1 u2 -> n%
  2397. This table defines the effect on the combat abilities
  2398. of a unit of type @var{u1} when an occupant in a unit of type @var{u2}.
  2399. If @code{0}, then the occupant cannot attack or fire.
  2400. Defaults to @code{100}.
  2401. @end deffn
  2402. @deffn Table @code{occupant-can-construct} u1 u2 -> t/f
  2403. This table is @code{true} if @var{u1} can 
  2404. create or complete units while an occupant of @var{u2}.
  2405. Defaults to @code{false}.
  2406. @end deffn
  2407. @deffn Table @code{occupant-can-have-occupants} u1 u2 -> t/f
  2408. This table is @code{true} if @var{u1} can have occupants of its own
  2409. while an occupant of @var{u2}.
  2410. Defaults to @code{false}.
  2411. @end deffn
  2412. @node Units and Terrain, Units and Materials, Occupants and Transports, Static Relationships Between Types
  2413. @subsection Units and Terrain
  2414. This section describes relationships between units and terrain.
  2415. Units can be set to disappear or be wrecked on particular types of
  2416. terrain.  If the terrain can be occupied safely, there may be a limit
  2417. on the numbers of units that can be in the same cell.
  2418. @deffn Table @code{vanishes-on} u t -> t/f
  2419. This table is @code{true} if a unit @var{u} will disappear instantly if it
  2420. somehow ends up on terrain of type @var{t}.
  2421. Defaults to @code{false}.
  2422. @end deffn
  2423. @deffn Table @code{wrecks-on} u t -> t/f
  2424. This table is @code{true} if a unit @var{u} will wreck instantly if it
  2425. somehow ends up on terrain of type @var{t}.
  2426. Defaults to @code{false}.
  2427. @end deffn
  2428. @deffn TerrainTypeProperty @code{capacity} n
  2429. This property is the limit on the sum of unit sizes that may share this cell.
  2430. Defaults to @code{1}.
  2431. @end deffn
  2432. @deffn Table @code{unit-size-in-terrain} u t -> n
  2433. This table is the ``size'' of a (full-sized) unit @var{u} when it is
  2434. in/on the terrain @var{t}.
  2435. Defaults to @code{1}.
  2436. @end deffn
  2437. @deffn Table @code{terrain-capacity-x} u t -> n
  2438. This table is the number of (full-sized) units of type @var{u}
  2439. that are guaranteed to have a place in the cell.
  2440. Defaults to @code{0}.
  2441. @end deffn
  2442. Note that the units' sides are irrelevant;
  2443. the sizes of units of all sides are added together.
  2444. Limits are calculated separately for the connection and open terrain
  2445. in a cell.
  2446. @deffn UnitTypeProperty @code{stack-order} n
  2447. This property is the relative position of this type of unit within a stack of
  2448. different units.
  2449. Larger values put units higher in the stack.
  2450. The exact values are unimportant, they are just used as sort keys.
  2451. The use of this value is to ensure that particular types are ``seen first''
  2452. when looking at a cell, so for instance if a truck and a city are stacked
  2453. on the same cell, everybody will see the city and not the truck.
  2454. The owner of these units can still see them.
  2455. If the stack-order of two units is the same,
  2456. then the higher-numbered type will be higher in the stack.
  2457. Defaults to @code{0}.
  2458. @end deffn
  2459. There is a possible bizarrity with stacking limits and units that can't
  2460. see each other when in the same hex, namely that a player could be prevented
  2461. from moving a unit into a cell that looks like it has enough room.
  2462. @node Units and Materials, Terrain and Materials, Units and Terrain, Static Relationships Between Types
  2463. @subsection Units and Materials
  2464. Units can carry materials.
  2465. @deffn Table @code{unit-storage-x} u m -> n
  2466. This table is the space reserved specifically for each
  2467. type of material.
  2468. Defaults to @code{0}.
  2469. @end deffn
  2470. Materials that represent people may surrender to a unit in their cell.
  2471. @deffn Table @code{people-surrender-chance} u t -> n%
  2472. This table is the base chance that people in terrain of type @var{t}
  2473. will change sides if a unit of type @var{u} is in their cell.
  2474. Defaults to @code{0}.
  2475. @end deffn
  2476. @deffn Table @code{people-surrender-effect} u m -> n
  2477. This is a multiplier that takes the people type into account.
  2478. Defaults to @code{100}.
  2479. @end deffn
  2480. @node Terrain and Materials,  , Units and Materials, Static Relationships Between Types
  2481. @subsection Terrain and Materials
  2482. @deffn Table @code{terrain-storage-x} t m -> n
  2483. This table is the amount of a material @var{m} that can be accumulated in a cell
  2484. with terrain @var{t}.
  2485. Defaults to @code{0}.
  2486. @end deffn
  2487. @node Vision, Game Initialization, Static Relationships Between Types, Reference Manual
  2488. @section Vision
  2489. @menu
  2490. * Basic Vision::
  2491. * Weather Vision::              
  2492. * Line of Sight::               
  2493. * Spying::                      
  2494. @end menu
  2495. @node Basic Vision, Weather Vision, Vision, Vision
  2496. @subsection Basic Vision
  2497. @deffn GlobalVariable @code{see-all} t/f
  2498. This variable is @code{true} if everything in the world, units, terrain, etc,
  2499. is always visible at all times, including initially.
  2500. It takes precedence over @i{all} other visibility and spying parameters.
  2501. Defaults to @code{false}.
  2502. @end deffn
  2503. @deffn GlobalVariable @code{see-terrain-always} t/f
  2504. If this variable is @code{true}, then any side that has seen the terrain of a cell
  2505. will be informed if that terrain ever changes.
  2506. Defaults to @code{true}.
  2507. @end deffn
  2508. @deffn UnitTypeProperty @code{see-always} t/f
  2509. This property is @code{true} when a unit is always visible
  2510. after it has been seen once,
  2511. so that side changes, movements, etc will be seen forever afterwards.
  2512. If the unit moves into terrain that has not been seen,
  2513. then that terrain also becomes seen as well.
  2514. Defaults to @code{false}.
  2515. @end deffn
  2516. @deffn UnitTypeProperty @code{see-occupants} t/f
  2517. This property is @code{true} when a unit's occupants are also seen
  2518. whenever the unit itself is under observation.
  2519. Defaults to @code{false}.
  2520. @end deffn
  2521. @deffn UnitTypeProperty @code{spot-action} t/f
  2522. If this property is @code{true},
  2523. then the unit's chance to be seen by other sides will be
  2524. tested each time the unit acts in any way.
  2525. This property is in addition to the check at the beginning of each turn.
  2526. Defaults to @code{true}.
  2527. @end deffn
  2528. The people in a cell effectively view (for their side)
  2529. all units in that cell.
  2530. Some units can hide from the people.
  2531. @deffn Table @code{people-see-chance} u m -> n%
  2532. This table is the chance that the people of the
  2533. given type @var{m} will see a unit of type @var{u}.
  2534. This will be evaluated for each people type individually,
  2535. once at the beginning of each turn, and once for each populated cell
  2536. that the unit enters during the turn.
  2537. Defaults to @code{100}.
  2538. @end deffn
  2539. @deffn UnitTypeProperty @code{vision-range} dist
  2540. This property is the maximum range of vision coverage by the unit.
  2541. A value of @code{-1} disables all vision,
  2542. @code{0} means only units in the same cell may be seen,
  2543. and @code{1} means units in adjacent cells may be seen.
  2544. Defaults to @code{1}.
  2545. @end deffn
  2546. @deffn Table @code{see-chance-at} u1 u2 -> n%
  2547. @end deffn
  2548. @deffn Table @code{see-chance-adjacent} u1 u2 -> n%
  2549. @end deffn
  2550. @deffn Table @code{see-chance} u1 u2 -> n%
  2551. All default to @code{100}.
  2552. @end deffn
  2553. @deffn Table @code{visibility} u t -> n
  2554. Defaults to @code{100}.
  2555. @end deffn
  2556. @deffn Table @code{vision-night-effect} u t -> n
  2557. This table is the multiplier for unit @var{u}'s vision at night
  2558. in each type of terrain @var{t}.
  2559. Effect is to multiply with both vision range and see-chance.
  2560. Defaults to @code{100}.
  2561. @end deffn
  2562. @node Weather Vision, Line of Sight, Basic Vision, Vision
  2563. @subsection Weather Vision
  2564. @deffn GlobalVariable @code{see-weather-always} t/f
  2565. If true, then weather changes (in cells that have been seen) will always be reported.
  2566. Defaults to @code{true}.
  2567. @end deffn
  2568. @node Line of Sight, Spying, Weather Vision, Vision
  2569. @subsection Line of Sight
  2570. @deffn UnitTypeProperty @code{vision-bend} n
  2571. This property is the amount by which a unit can see ``around corners''.
  2572. 0 means that vision is strictly line-of-sight,
  2573. while 100 means that elevations never obstruct vision.
  2574. Defaults to @code{100}.
  2575. @end deffn
  2576. @deffn Table @code{eye-height} u t -> dist
  2577. This propety is the additional elevation above the unit's position that a unit
  2578. can see with, when in the given terrain.
  2579. Defaults to @code{0}.
  2580. @end deffn
  2581. @deffn TerrainTypeProperty @code{thickness} dist
  2582. This property is the thickness of the terrain, which is the difference between
  2583. the ``ground'' of the terrain and its top.
  2584. Defaults to @code{0}.
  2585. @end deffn
  2586. @node Spying, , Line of Sight, Vision
  2587. @subsection Spying
  2588. A unit type can also be specified to do spying automatically.
  2589. The outcome of spying is calculated once/unit/turn,
  2590. at the beginning of the turn (after move calculation but before
  2591. any players can do anything).
  2592. Spying can happen to any unit not on the spying unit's side.
  2593. @deffn UnitTypeProperty @code{spy-chance} .01n%
  2594. This property is the chance that the unit's spies will find out something.
  2595. Defaults to @code{0}.
  2596. @end deffn
  2597. @deffn UnitTypeProperty @code{spy-range} dist
  2598. This property is the maximum distance at which the unit's spies will find out
  2599. something.
  2600. Defaults to @code{0}.
  2601. @end deffn
  2602. @deffn Table @code{spy-quality} u1 u2 -> n%
  2603. This table gives the chance that @var{u1}'s spies will return information
  2604. about a unit of type @var{u2}.
  2605. Defaults to @code{100}.
  2606. @end deffn
  2607. @node Game Initialization, Synthesis Methods, Vision, Reference Manual
  2608. @section Game Initialization
  2609. Game initialization always starts by resetting all the game-defining data
  2610. structures to an empty state.  This means no types, no world, etc.
  2611. Then @i{Xconq} reads and interprets
  2612. all of the game modules that have been requested.
  2613. These modules may overwrite each other arbitrarily.
  2614. Then any command line or startup options
  2615. are processed (this may involve an interactive dialog),
  2616. and the random number generator is initialized.
  2617. and players are matched with sides
  2618. (any sides needed for players will be created and named at this time).
  2619. @i{Xconq} then executes a number of @i{synthesis methods}
  2620. to do various kinds of setup.
  2621. (Some interfaces might allow for confirmation of the setup before
  2622. launching into the game proper, but this cannot be assumed.)
  2623. Since the details of good game synthesis can be complicated,
  2624. synthesis methods are simply wired-in pieces of code.
  2625. Each method is self-contained; it assumes the game state to be valid,
  2626. it will determine its own applicability and
  2627. produce a valid result.  It will also acquire any data that it
  2628. needs, so does not require any special setup;  however, a method
  2629. may fail to run if it cannot find that data.
  2630. For instance, the usual fractal
  2631. terrain generator needs percentiles for each terrain type, and
  2632. will not function without them.  It may be that all the requested
  2633. synthesis methods fail; this is OK if @i{Xconq}'s data is present
  2634. and consistent, but otherwise @i{Xconq} will shut itself down, since
  2635. it has no remaining alternatives (think of this as a serious
  2636. programming error and fix the game design).
  2637. @node Synthesis Methods, Setup Postprocessing, Game Initialization, Reference Manual
  2638. @section Synthesis Methods
  2639. The synthesis method list specifies which methods will be run,
  2640. and in what order.
  2641. After they have all been run, @i{Xconq} runs a consistency and completeness
  2642. check.  For instance, there should be a world with terrain everywhere.
  2643. Failure at this point is fatal; @i{Xconq} will either exit
  2644. or return to a game setup dialog.
  2645. @menu
  2646. * Synthesis Method List::
  2647. * Fractal World::               
  2648. * Maze World::                  
  2649. * Random World::                
  2650. * Earthlike World::             
  2651. * Making Rivers::            
  2652. * Making Roads::             
  2653. * Making Countries::            
  2654. * Making Independent Units::    
  2655. * Making Weather::              
  2656. * Initial Supply::              
  2657. * Naming Geographical Features::  
  2658. * Naming Units::                
  2659. * Making a Random Date::        
  2660. @end menu
  2661. @node Synthesis Method List, Fractal World, Synthesis Methods, Synthesis Methods
  2662. @subsection Synthesis Method List
  2663. @deffn GlobalVariable @code{synthesis-methods} method-list
  2664. This variable is a list of synthesis methods.
  2665. If the list is empty, no synthesis methods will be run.
  2666. @end deffn
  2667. The list of synthesis methods is ordered, and many contain duplicates,
  2668. so that a method can be run multiple times during setup.
  2669. Note that most of the existing methods will simply return if they
  2670. detect that their work has already been done, so multiple runs will
  2671. have no effect.
  2672. The default synthesis method list is effectively
  2673. @example
  2674. (make-fractal-percentile-terrain
  2675.  make-countries
  2676.  make-independent-units
  2677.  make-roads
  2678.  make-rivers
  2679.  make-weather
  2680.  init-supplies
  2681.  name-geographical-features
  2682. @end example
  2683. The synthesis method list may also contain items of the form
  2684. @example
  2685. ("program" forms...)
  2686. @end example
  2687. For each of these items, @i{Xconq} will attempt to find and run
  2688. an external program named @code{"program"},
  2689. giving it as input the result of evaluating the @code{forms},
  2690. and then reading the output of the program, which must be a valid
  2691. game module.
  2692. The program must be capable of interpreting two arguments;
  2693. the first is the name of the input file it is to read from,
  2694. and the second is the name of the output file it must write to.
  2695. If successful, it should return with a result code of 0;
  2696. otherwise, @i{Xconq} will issue a warning to players.
  2697. Any further details will depend on your system,
  2698. since each will use different conventions.
  2699. Note that this is NOT a portable construct; you cannot assume that
  2700. everybody will have built and installed the program you're using.
  2701. @node Fractal World, Maze World, Synthesis Method List, Synthesis Methods
  2702. @subsection Fractal World
  2703. The fractal world synthesizer can make a variety of natural-looking terrain.
  2704. It relies on a number of parameters to govern a single algorithm.
  2705. @deffn SynthesisMethod @code{make-fractal-percentile-terrain}
  2706. This method generates the terrain layer of a world.
  2707. It works by generating two distinct layers of random blobs,
  2708. known as the ``alt'' and ``wet'' layers,
  2709. then decides on a terrain type for each cell.
  2710. If elevations are defined,
  2711. then this method will use the ``alt'' layer to produce elevations.
  2712. @end deffn
  2713. @deffn GlobalVariable @code{alt-blob-density} n
  2714. @end deffn
  2715. @deffn GlobalVariable @code{wet-blob-density} n
  2716. These variables are the number of blobs to put down,
  2717. expressed as number per 10,000 cells.
  2718. Defaults to @code{500}.
  2719. @end deffn
  2720. @deffn GlobalVariable @code{alt-blob-size} n.f%
  2721. @end deffn
  2722. @deffn GlobalVariable @code{wet-blob-size} n.f%
  2723. These variables are the average number of cells in a blob,
  2724. expressed as number per 10,000 cells.
  2725. Defaults to @code{100}.
  2726. @end deffn
  2727. @deffn GlobalVariable @code{alt-blob-height} n
  2728. @end deffn
  2729. @deffn GlobalVariable @code{wet-blob-height} n
  2730. These variables are the amounts by which to increment or decrement within a blob.
  2731. Defaults to @code{1000}.
  2732. @end deffn
  2733. @deffn GlobalVariable @code{alt-smoothing} n
  2734. @end deffn
  2735. @deffn GlobalVariable @code{wet-smoothing} n
  2736. These variables specify the number of averaging steps
  2737. to perform after the blobs have been generated.
  2738. Defaults to @code{2}.
  2739. @end deffn
  2740. @deffn TerrainTypeProperty @code{alt-percentile-min} n%
  2741. @end deffn
  2742. @deffn TerrainTypeProperty @code{alt-percentile-max} n%
  2743. @end deffn
  2744. @deffn TerrainTypeProperty @code{wet-percentile-min} n%
  2745. @end deffn
  2746. @deffn TerrainTypeProperty @code{wet-percentile-max} n%
  2747. These properties are
  2748. the percentiles of elevations and moistures that result in the given
  2749. terrain type.
  2750. Percentile ranges may overlap, in which case the earlier-defined
  2751. terrain type will be used.
  2752. If a cell has a alt and wet that does not fall in any of the ranges,
  2753. then terrain type 0 will be used there and players will be warned.
  2754. Mins defaults to @code{0}, maxes to @code{100}.
  2755. @end deffn
  2756. @node Maze World, Random World, Fractal World, Synthesis Methods
  2757. @subsection Maze World
  2758. A maze consists of a set of randomly placed ``rooms'' connected by random
  2759. passages.
  2760. @deffn SynthesisMethod @code{make-maze-terrain}
  2761. This method creates terrain that looks like a maze.
  2762. It starts by randomly assigning terrain according to its @code{occurrence},
  2763. similarly to @code{make-random-terrain} below, then carves
  2764. out rooms and passages, filling each of those with terrain
  2765. types according to their respective occurrences.
  2766. @end deffn
  2767. @deffn TerrainTypeProperty @code{maze-room-occurrence} n
  2768. This property is the weighted amount of this terrain type
  2769. in rooms in the maze.
  2770. Defaults to @code{0}.
  2771. @end deffn
  2772. @deffn TerrainTypeProperty @code{maze-passage-occurrence} n
  2773. This property is the weighted amount of this terrain type
  2774. in passageways in the maze.
  2775. Defaults to @code{0}.
  2776. @end deffn
  2777. @deffn GlobalVariable @code{maze-room-density} n
  2778. This variable is the fraction of the maze that is room,
  2779. expressed as the number of cells per 10,000 cells in the area.
  2780. Defaults to @code{1000}.
  2781. @end deffn
  2782. @deffn GlobalVariable @code{maze-passage-density} n
  2783. This variable is the fraction of the area that is passageway,
  2784. expressed as the number of cells per 10,000 cells in the area.
  2785. Defaults to @code{3000}.
  2786. @end deffn
  2787. @node Random World, Earthlike World, Maze World, Synthesis Methods
  2788. @subsection Random World
  2789. The random world generator just assigns terrain and elevations randomly.
  2790. @deffn SynthesisMethod @code{make-random-terrain}
  2791. This method generates completely random terrain.
  2792. It uses a simple weighting to govern how much
  2793. of each terrain type appears, and makes random elevations as well.
  2794. @end deffn
  2795. @deffn TerrainTypeProperty @code{occurrence} n
  2796. This property is the percentage of the world that will be of this type,
  2797. if the terrain is cell terrain.
  2798. If the terrain is border or connection, it is the probability
  2799. (expressed as .01% increments) that any direction of any cell
  2800. will have that border or connection.
  2801. Defaults to @code{1}.
  2802. @end deffn
  2803. @node Earthlike World, Making Rivers, Random World, Synthesis Methods
  2804. @subsection Earthlike World
  2805. Earthlike generation uses algorithms that more closely approximate
  2806. realistic terrain.
  2807. @deffn SynthesisMethod @code{make-earthlike-terrain}
  2808. This method generates terrain that approximates what actually
  2809. appears on Earth.
  2810. @end deffn
  2811. @node Making Rivers, Making Roads, Earthlike World, Synthesis Methods
  2812. @subsection Making Rivers
  2813. Rivers are borders or connections consisting of ``watery terrain''
  2814. that run downhill to regions of water.
  2815. @deffn SynthesisMethod @code{make-rivers}
  2816. This method looks for a border or connection
  2817. terrain type with a @code{subtype-x} of @code{river-x}.
  2818. then uses the world's elevation data to run rivers downhill
  2819. (always choosing the lowest of possible adjacent locations)
  2820. until they reach cell terrain with a @code{subtype} > 0.
  2821. This method will not run if there are no appropriate terrain types,
  2822. nor if there is no elevation data.
  2823. @end deffn
  2824. @deffn TerrainTypeProperty @code{river-chance} n%
  2825. This property is the chance that a river will start in or around a cell of this
  2826. terrain type.
  2827. Defaults to @code{0}.
  2828. @end deffn
  2829. @deffn GlobalVariable @code{river-sink-terrain} t
  2830. If the value of this variable is a terrain type, then a cell completely
  2831. surrounded by river will be changed to be this type.
  2832. Defaults to @code{non-terrain}.
  2833. @end deffn
  2834. Note that the algorithm computes rivers in a deterministic way,
  2835. so high values of @code{river-chance} do not result in tangled rivers.
  2836. @node Making Roads, Making Countries, Making Rivers, Synthesis Methods
  2837. @subsection Making Roads
  2838. The road generation method makes networks of connection terrain between
  2839. particular unit types, usually those resembling cities.
  2840. @deffn SynthesisMethod @code{make-roads}
  2841. This methods synthesizes roads for an area.
  2842. For any connection type of terrain, if no layer has been created for it
  2843. already, and the type has a @code{subtype-x} of 3,
  2844. put down roads between any pair of units whose
  2845. @code{road-chance} is nonzero.
  2846. The method will attempt to share road routes whenever possible,
  2847. and choose terrain according to @code{road-into-chance}.
  2848. @end deffn
  2849. @deffn Table @code{road-chance} u1 u2 -> n%
  2850. This table is the chance that a road will be laid, running
  2851. from a unit of type @var{u1} to one of type @var{u2}.
  2852. This is not a symmmetrical relationship.
  2853. Defaults to @code{0}.
  2854. @end deffn
  2855. @deffn Table @code{road-into-chance} t1 t2 -> n%
  2856. This table is the chance that a road will be chosen to pass
  2857. from terrain of type @var{t1} into terrain of type @var{t2}.
  2858. Defaults to @code{100}.
  2859. @end deffn
  2860. @node Making Countries, Making Independent Units, Making Roads, Synthesis Methods
  2861. @subsection Making Countries
  2862. The @code{make-countries} method sets up the starting units for
  2863. each side, placing them in a confined area, separated from the
  2864. starting units of other sides and taking terrain preferences
  2865. into account.  If requested, this method will also expand the
  2866. country outwards by a specified amount, possibly placing additional
  2867. units in the process.
  2868. @deffn SynthesisMethod @code{make-countries}
  2869. This method works by looking for a likely place for the country,
  2870. randomly places a basic set of starting units within that area,
  2871. then expands the country outwards.
  2872. The parameters give you control over the mix of terrain types
  2873. in the country, as well as the size and relative positions of the
  2874. different countries.
  2875. This method runs on any side with fewer units than it is supposed
  2876. to start with, as given by the parameters below.
  2877. It places groups of units at locations separated from each other
  2878. by specified distances.
  2879. @end deffn
  2880. @deffn GlobalVariable @code{country-radius-min} dist
  2881. This variable is the radius of the country's initial area.
  2882. Defaults to @code{-1}, which allows the algorithm to calculate a ``reasonable''
  2883. country size appropriate to the given number of units.
  2884. @end deffn
  2885. @deffn GlobalVariable @code{country-separation-min} dist
  2886. @end deffn
  2887. @deffn GlobalVariable @code{country-separation-max} dist
  2888. These variables are the minimum and maximum
  2889. distances of country centers from each other, in cells.
  2890. If small, countries will mostly overlap;
  2891. if very large, then attempts to use small worlds will fail;
  2892. if the max and min are too close to each other, placements can also fail.
  2893. For both of these, a value of @code{-1} disables their effect.
  2894. Both default to @code{-1}.
  2895. @end deffn
  2896. The max separation bound needs to be satisfied for a country
  2897. with respect to only @i{one} other country,
  2898. so for instance the final layout may involve a long
  2899. ``string'' of countries where the first and last countries are very far apart
  2900. from each other.
  2901. The minimum bound must be satisfied for all pairs of countries.
  2902. @deffn TerrainTypeProperty @code{country-terrain-min} n
  2903. This property is the minimum amount of terrain
  2904. that must be within the country's initial radius.
  2905. Defaults to @code{0}.
  2906. @end deffn
  2907. @deffn TerrainTypeProperty @code{country-terrain-max} n
  2908. This property is the most terrain of the given type that may appear.
  2909. If @code{-1}, then any amount may be present.
  2910. Defaults to @code{-1}.
  2911. @end deffn
  2912. @deffn UnitTypeProperty @code{start-with} n
  2913. @end deffn
  2914. @deffn UnitTypeProperty @code{independent-near-start} n
  2915. These properties set the number of units of the given type in a player's country.
  2916. These units are randomly scattered within the initial radius,
  2917. and the @code{favored} table (see below) decides which terrains
  2918. will be used.  Units may be placed inside each other; in fact,
  2919. units with no favored terrain will be made into occupants if possible.
  2920. The independent units will be placed after the ones belonging to the side,
  2921. so on the average they will get the less desirable locations in the country.
  2922. Both independent and the side's units will be named using the side's namers.
  2923. Both default to @code{0}.
  2924. @end deffn
  2925. @deffn Table @code{favored-terrain} u t -> n%
  2926. This table sets
  2927. the probability of the unit type being on the given type of terrain at the
  2928. outset.  A value of @code{0} is an absolute prohibition against placing
  2929. the unit on that type of terrain, thus every game must specify at least
  2930. one non-zero value for some terrain type and some initial unit type.
  2931. Defaults to @code{100}.
  2932. @end deffn
  2933. Once the initial country area has been set up,
  2934. then you can allow the countries to expand outwards.
  2935. Expansion occurs at the same rate for all countries.
  2936. Countries may expand into and through each other.
  2937. @deffn TerrainTypeProperty @code{country-growth-chance} n%
  2938. This property is the chance that a country will expand onto an unclaimed cell
  2939. of the given terrain type.
  2940. Defaults to @code{100}.
  2941. @end deffn
  2942. @deffn TerrainTypeProperty @code{country-takeover-chance} n%
  2943. This property is the chance that a country will expand onto another country's cell
  2944. of the given terrain type.
  2945. Defaults to @code{0}.
  2946. @end deffn
  2947. @deffn UnitTypeProperty @code{unit-growth-chance} n.f%
  2948. This property is the chance that a unit of the given type will be placed
  2949. when the country expands onto a cell.
  2950. The unit will only be placed if the @code{favored} chance is also true.
  2951. Defaults to @code{0}.
  2952. @end deffn
  2953. @deffn UnitTypeProperty @code{independent-growth-chance} n.f%
  2954. This property is the chance that an independent unit of the given type will be placed
  2955. when the country expands onto a cell.
  2956. The @code{favored} chance is also evaluated.
  2957. Defaults to @code{0}.
  2958. @end deffn
  2959. @deffn UnitTypeProperty @code{unit-takeover-chance} n.f%
  2960. This property is the chance that a unit of the given type in another country and
  2961. belonging to another side will be given to the growing side.
  2962. Defaults to @code{0}.
  2963. @end deffn
  2964. @deffn UnitTypeProperty @code{independent-takeover-chance} n.f%
  2965. This property is the chance that an independent unit of the given type in
  2966. another country will be given to the growing side.
  2967. Defaults to @code{0}.
  2968. @end deffn
  2969. @deffn GlobalVariable @code{country-radius-max} dist
  2970. This variable is a cap on the country growth process.
  2971. Values between @code{0} and @code{country-radius-min}
  2972. prevent country growth entirely,
  2973. while a value of @code{-1} allows growth to encompass the entire world.
  2974. Defaults to @code{0}.
  2975. @end deffn
  2976. @deffn UnitTypeProperty @code{country-units-max} n
  2977. This property is a cap on the number of units given to the side's country.
  2978. Defaults to @code{-1}, which disables any limit.
  2979. @end deffn
  2980. @deffn GlobalVariable @code{growth-stop-chance} n%
  2981. This variable is the chance that a country's growth will stop,
  2982. if during the current [ring or round] no new cells were added
  2983. to the country.
  2984. Defaults to @code{0}.
  2985. @end deffn
  2986. @deffn TerrainTypeProperty @code{country-people-chance} n%
  2987. This property is the chance that the people's side will be changed to
  2988. match that for the country they are in.
  2989. Defaults to @code{100}.
  2990. @end deffn
  2991. @node Making Independent Units, Making Weather, Making Countries, Synthesis Methods
  2992. @subsection Making Independent Units
  2993. @deffn SynthesisMethod @code{make-independent-units}
  2994. This method scatters independent units randomly
  2995. over the world.
  2996. This method will not run if the specified density of independent units
  2997. has already
  2998. been achieved, for instance from a predefined world or from country placement.
  2999. Independent units that should be inside other independents will be
  3000. handled correctly.
  3001. @end deffn
  3002. @deffn Table @code{independent-density} u t -> n
  3003. This table is the total number of independent units appearing throughout the world,
  3004. at the rate of @var{n} per 10,000 cells
  3005. of the given terrain type.
  3006. Any independent units already placed are counted first,
  3007. so this value represents final density.
  3008. If the sum of values for a given unit type on all terrain types is nonzero,
  3009. then at least one unit of that type will
  3010. be placed, even if the world is very small (i.e. the calculation of
  3011. numbers rounds up not down).
  3012. Defaults to @code{0}.
  3013. @end deffn
  3014. This method uses the @code{favored-terrain} table as the chance that a given
  3015. unit will be placed at a randomly-chosen position,
  3016. and it will keep trying different positions until a suitable one is
  3017. found.
  3018. @deffn TerrainTypeProperty @code{independent-people-chance} .01n%
  3019. This property is the chance that the people of a cell with this terrain type
  3020. will be made independent.
  3021. Deafults to @code{0}.
  3022. @end deffn
  3023. @node Making Weather, Initial Supply, Making Independent Units, Synthesis Methods
  3024. @subsection Making Weather
  3025. @deffn SynthesisMethod @code{make-weather}
  3026. This methods sets up weather-related layer.  These
  3027. include temperature, winds, and clouds.
  3028. @end deffn
  3029. @node Initial Supply, Naming Geographical Features, Making Weather, Synthesis Methods
  3030. @subsection Initial Supply
  3031. By default, all units start out empty of materials.
  3032. The supply initialization method gives each unit a starting supply,
  3033. according to the stockpile tables.
  3034. @deffn SynthesisMethod @code{make-initial-materials}
  3035. This method fills unit and cell supplies to specified levels.
  3036. It will fill all units in existence at the moment it runs,
  3037. including reinforcements [and incomplete?] units.
  3038. Similarly, all cells will be filled.
  3039. @end deffn
  3040. @deffn Table @code{unit-initial-supply} u m -> n
  3041. This table is the amount of each material that each unit will start out with.
  3042. If the initial supply is greater than unit's capacity,
  3043. then the unit will just be filled to capacity.
  3044. Defaults to @code{0}.
  3045. @end deffn
  3046. @deffn Table @code{terrain-initial-supply} t m -> n
  3047. This table is the amount of material @var{m} that each cell
  3048. with terrain @var{t} will start out with.
  3049. This will be limited by the cell's capacity.
  3050. Defaults to @code{0}.
  3051. @end deffn
  3052. @node Naming Geographical Features, Naming Units, Initial Supply, Synthesis Methods
  3053. @subsection Naming Geographical Features
  3054. Although named geographical features don't affect the outcome of a game
  3055. in any way, they are useful for ``color'' and for identifying locations
  3056. more readably.
  3057. @deffn SynthesisMethod @code{name-geographical-features}
  3058. This method identifies and names regions as geographical features,
  3059. such as mountain ranges and islands.
  3060. @end deffn
  3061. @deffn GlobalVariable @code{feature-namers} feature-namer-list
  3062. This variable is a list of feature types and their associated namers.
  3063. This is used for features not intersecting any country
  3064. with a namer for the feature's type.
  3065. Defaults to @code{()}.
  3066. @end deffn
  3067. @deffn GlobalVariable @code{feature-types} feature-expr-list
  3068. This variable is a list of feature types that may be identified.
  3069. Examples: @code{("lake" (group (sea shallows) 1))},
  3070. @code{("peak" (high-point 1 1))}
  3071. Defaults to @code{()}.
  3072. @end deffn
  3073. @node Naming Units, Making a Random Date, Naming Geographical Features, Synthesis Methods
  3074. @subsection Naming Units
  3075. @deffn SynthesisMethod @code{name-units-randomly}
  3076. This method gives names to previously-unnamed units,
  3077. using their usual [?] naming methods.
  3078. @end deffn
  3079. @node Making a Random Date,  , Naming Units, Synthesis Methods
  3080. @subsection Making a Random Date
  3081. @deffn SynthesisMethod @code{make-random-date}
  3082. @end deffn
  3083. [how is this controlled?]
  3084. @node Setup Postprocessing, Naming and Text Generation, Synthesis Methods, Reference Manual
  3085. @section Setup Postprocessing
  3086. Some initialization steps will be done after all synthesis methods
  3087. have been run.  @i{Xconq} will always do these.
  3088. @menu
  3089. * Initial View::
  3090. * Edge Terrain::
  3091. @end menu
  3092. @node Initial View, Edge Terrain, Setup Postprocessing, Setup Postprocessing
  3093. @subsection Initial View
  3094. By default, each side starts out knowing only what its units can
  3095. normally see at the beginning of the first turn.
  3096. These parameters add to that initial view.
  3097. @deffn GlobalVariable @code{terrain-seen} t/f
  3098. This variable is @code{true} if all the terrain of the world is known initially.
  3099. Defaults to @code{false}.
  3100. @end deffn
  3101. @deffn UnitTypeProperty @code{initial-seen-radius} dist
  3102. This property specifies the radius of the area seen around each of
  3103. the starting units.
  3104. It computes visibility of terrain (cells and borders) only.
  3105. Defaults to @code{1} (which is a no-op if the unit's @code{vision-range}
  3106. is greater than or equal to 1).
  3107. @end deffn
  3108. @deffn UnitTypeProperty @code{already-seen} n%
  3109. This property is the chance to see units of this type at
  3110. the beginning of the game.
  3111. This applies only to units belonging to another side,
  3112. and on known terrain.
  3113. The effect is one-time, so if an @code{already-seen} unit changes
  3114. sides later on, other players will not see the change unless
  3115. they have the unit under observation for themselves.
  3116. Note that @code{see-always} implies @code{already-seen}.
  3117. Defaults to @code{0}.
  3118. @end deffn
  3119. @deffn UnitTypeProperty @code{already-seen-independent} n%
  3120. This property is like @code{already-seen},
  3121. but applies to independent units specifically.
  3122. Defaults to @code{0}.
  3123. @end deffn
  3124. @node Edge Terrain, , Initial View, Setup Postprocessing
  3125. @section Edge Terrain
  3126. @deffn GlobalVariable @code{edge-terrain}
  3127. This variable is the type of terrain to fill in on all the edges of a world.
  3128. The edges of a world have little or no effect on the game,
  3129. but the terrain type should be something distinctive, so that players
  3130. can recognize the edges easily.  (For instance, ice is usually a good choice
  3131. for edges, but probably not on a map of Antarctica!)
  3132. @end deffn
  3133. @node Naming and Text Generation, Actions, Setup Postprocessing, Reference Manual
  3134. @section Naming and Text Generation
  3135. @i{Xconq} can generate names for sides, units, and geographical features.
  3136. Although most naming happens during game setup, names may be assigned
  3137. throughout the course of a game, both automatically and by player request.
  3138. @menu
  3139. * Naming Sides::                
  3140. * Namers::                      
  3141. * Naming Methods::              
  3142. @end menu
  3143. @node Naming Sides, Namers, Naming and Text Generation, Naming and Text Generation
  3144. @subsection Naming Sides
  3145. Side naming is special, because several different but related names
  3146. have to be produced.
  3147. @deffn Variable @code{side-library} side-info@dots{}
  3148. This variable is a weighted list of groups of side properties,
  3149. each of which may be used to fill in a side.
  3150. @end deffn
  3151. The form of each side name entry is basically a subset of the
  3152. side's properties:
  3153. @example
  3154. ([weight] ... (name "name") ... (color-scheme "colors") ...)
  3155. @end example
  3156. Each entry can include as many or as few of the attributes as desired;
  3157. any missing will be filled in from the usual defaults.
  3158. The optional @var{weight} is a number that adjusts the probability of selection
  3159. of the given side name set; it defaults to 1, and the probability is scaled
  3160. according to the sum of the weights for all the sides listed.
  3161. If any property value is a namer, then the namer will be run.
  3162. (Note that if multiple namers are specified, they cannot be guaranteed
  3163. to coordinate with each other, so you can end up with a side noun
  3164. that is inappropriate for its corresponding side name.)
  3165. @node Namers, Naming Methods, Naming Sides, Naming and Text Generation
  3166. @subsection Namers
  3167. Since one of the purposes of naming is to identify objects uniquely,
  3168. any name generator should be able to maintain some memory as to
  3169. what has been generated already.
  3170. The objects that do this are @dfn{namers}.
  3171. @deffn Form @code{namer} [symbol/id] method rejects@dots{}
  3172. This form defines an instance of a namer, with either the symbolic
  3173. name or numeric id.  If either matches the name or id of an existing
  3174. namer, then the old namer will be overwritten, otherwise a new one
  3175. will be created.
  3176. The @var{method} must be one of the naming methods listed below,
  3177. and @var{rejects} defines what names may not be produced (its exact
  3178. interpretation depends on the method).
  3179. @end deffn
  3180. @node Naming Methods,  , Namers, Naming and Text Generation
  3181. @subsection Naming Methods
  3182. As with general synthesis, @i{Xconq} has a number of @dfn{naming methods}
  3183. available.
  3184. An implementation is free to define additional naming methods.
  3185. @deffn NamingMethod @code{random} names...@dots{}
  3186. This method picks a name from the given list of names
  3187. and removes that name from the list 
  3188. @end deffn
  3189. @deffn NamingMethod @code{junky}
  3190. This method produces a gobbledy-gook name, very techy-looking.
  3191. @end deffn
  3192. @deffn NamingMethod @code{grammar} root max-length rules@dots{}
  3193. This method defines a grammar, where @var{root} is the root symbol,
  3194. @var{max-length} is a limit on the length of the generated names
  3195. (in characters),
  3196. and @var{rules} is a list of rules of the form
  3197. @example
  3198. (@var{symbol} ([sym] [weight] @var{symbol/string/list} [n] @dots{}))
  3199. @end example
  3200. @end deffn
  3201. The generation process works by substituting one of the rule's alternatives
  3202. for the symbol, starting with the root symbol.
  3203. The probability of an alternative being selected is arrived at by
  3204. adding up the optional weights @var{weight} (assuming missing weights
  3205. to be @code{1}), and choosing with a probability of the weight
  3206. divided by the total sum of weights.
  3207. Thus the weights need not add up to any particular value.
  3208. Strings get used directly.
  3209. If a symbol in the rule's chosen expansion does not appear as the 
  3210. lefthand side in any rule, then it will be handled as a string,
  3211. otherwise it will be expanded in turn.
  3212. If the symbol matches a namer's name, then that namer will be
  3213. run (passing the same object??) and its result incorporated.
  3214. A list should be a list of strings and symbols, and the expansion
  3215. of each will be concatenated.
  3216. @deffn GlobalConstant @code{any}
  3217. [???]
  3218. @end deffn
  3219. @deffn GlobalConstant @code{or}
  3220. @end deffn
  3221. @deffn GlobalConstant @code{reject}
  3222. A special rule headed by @code{reject} is a list of substrings
  3223. that should not appear in a generated name; this is a convenient
  3224. way to filter out particularly unlovely results.
  3225. @end deffn
  3226. @deffn GlobalConstant @code{capitalize}
  3227. Directs capitalization of a nonterminal.
  3228. @end deffn
  3229. [text is not actually different from a namer?]
  3230. @deffn Form @code{text} [symbol/id] method rejects@dots{}
  3231. @end deffn
  3232. [elsewhere?]
  3233. @deffn GlobalVariable @code{action-messages} patterns
  3234. @end deffn
  3235. @deffn GlobalVariable @code{event-messages} patterns
  3236. @end deffn
  3237. @node Actions, Backdrop Environment Parameters, Naming and Text Generation, Reference Manual
  3238. @section Actions
  3239. The parameters in this section define and regulate the various actions that are
  3240. available to units during a game.
  3241. Actions always start and complete (including all of their effects)
  3242. within the same turn, and a unit can only do one at a time.
  3243. All actions are potentially available to all units, but the parameters
  3244. can be set so as to deny any action type to any unit type.
  3245. See the descriptions with each action type.
  3246. All action is limited by action points.
  3247. Each unit gets a certain number at the beginning of each
  3248. turn and expends them in the course of doing things.
  3249. The usual expenditure is
  3250. one point per action, but may be more, as defined for each type of action.
  3251. A unit action must always consume at least one action point.
  3252. Units can accumulate acp from turn to turn, and they can also reduce
  3253. acp below zero.
  3254. @menu
  3255. * Actions in General::
  3256. * Action Ordering:: 
  3257. * Movement Action::
  3258. * Entry Action::
  3259. * Research Action::            
  3260. * Toolup Action::              
  3261. * Unit Creation Actions::       
  3262. * Unit Completion Action::
  3263. * Repair Action::
  3264. * Material Production Action::
  3265. * Material Transfer Action::
  3266. * Side Change Action::
  3267. * Disband Action::
  3268. * Part Transfer Action::
  3269. * Type Change Action::         
  3270. * Combat Actions::             
  3271. * Capture Action::             
  3272. * Detonation Action::
  3273. * Terrain Alteration Actions::
  3274. @end menu
  3275. @node Actions in General, Action Ordering, Actions, Actions
  3276. @subsection Actions in General
  3277. @deffn UnitTypeProperty @code{acp-per-turn} acp
  3278. This property is the basic allowance of action points that a unit gets each turn.
  3279. Defaults to @code{0}.
  3280. @end deffn
  3281. @deffn UnitTypeProperty @code{acp-min} acp
  3282. This property specifies how far into ``action debt'' a unit can go
  3283. during a turn before it is prevented entirely from acting.
  3284. A unit with acp < 1 at the beginning of a turn cannot do anything at all.
  3285. Defaults to @code{0}.
  3286. @end deffn
  3287. @deffn UnitTypeProperty @code{acp-max} acp
  3288. This property is
  3289. the maximum number of action points that a unit can save up.
  3290. The value @code{-1} means that @code{acp-max} is equal to @code{acp}.
  3291. Extra acp is silently lost.
  3292. Defaults to @code{-1}. 
  3293. @end deffn
  3294. @deffn UnitTypeProperty @code{free-acp} acp
  3295. This property is
  3296. the value is the amount by which the action points for some
  3297. action can exceed the unit's currently available acp
  3298. and still allow that action.
  3299. Defaults to @code{-1}, which means enough free acp to
  3300. allow any action.
  3301. @end deffn
  3302. Note that a unit with an acp of 0 is completely unintelligent, about like
  3303. a cow patty.  Cow patties can be useful for blocking paths, hiding behind,
  3304. and suchlike, and have the advantage that once they're in place, you don't
  3305. have to manage them.  Other units will have to pick them up and put them
  3306. down, of course.
  3307. @deffn Table @code{material-to-act} u m -> n
  3308. This table is a minimum amount of @var{m} needed for @var{u} to be able to act.
  3309. The material is not consumed.
  3310. Defaults to @code{0}.
  3311. @end deffn
  3312. @deffn UnitTypeProperty @code{acp-damage-effect} xxx
  3313. @end deffn
  3314. @deffn Table @code{acp-night-effect} u t -> n
  3315. This table is the multiplier for unit's acp at night in each type of terrain.
  3316. Defaults to @code{100}.
  3317. @end deffn
  3318. @deffn Table @code{acp-occupant-effect} u1 u2 -> n
  3319. Defaults to @code{100}.
  3320. @end deffn
  3321. @deffn UnitTypeProperty @code{acp-per-turn-min} acp
  3322. This property sets a lower limit on the effect of occupants,
  3323. damage, and other modifiers on the acp to be added at the beginning
  3324. of the turn.
  3325. Defaults to @code{0}.
  3326. @end deffn
  3327. @deffn UnitTypeProperty @code{acp-per-turn-max} acp
  3328. This property set the upper limit on the effect of occupants
  3329. and other modifiers to the acp added at the beginning of the turn.
  3330. Defaults to @code{-1}, which indicate no limit.
  3331. @end deffn
  3332. @node Action Ordering, Movement Action, Actions in General, Actions
  3333. @subsection Action Ordering
  3334. @deffn GlobalVariable @code{use-side-priority} t/f
  3335. This variable is @code{true} if the sides may only act one at a time;
  3336. otherwise, all sides and units may move simultaneously during a turn.
  3337. Defaults to @code{false}.
  3338. @end deffn
  3339. @deffn UnitTypeProperty @code{action-priority} n
  3340. This property is the order in which units of this type will act.
  3341. Higher numbers act earlier.
  3342. If the difference between the priority of one type and another
  3343. is greater than 100, then the earlier-acting units must finish acting
  3344. before the later-acting units, otherwise a player can rearrange the actual
  3345. acting order as desired.
  3346. Defaults to @code{0}.
  3347. @end deffn
  3348. @node Movement Action, Entry Action, Action Ordering, Actions
  3349. @subsection Movement Action
  3350. Movement is the most common sort of action.
  3351. This section covers movement over open terrain;
  3352. the next section discusses interaction with transports.
  3353. The general theory of movement is that a unit not in a transport
  3354. crosses its current cell terrain to the edge of the cell,
  3355. crosses any border terrain, and then moves into the destination cell,
  3356. OR it moves onto connection terrain,
  3357. travels along connection terrain to the new cell, and maybe 
  3358. moves off the connection.
  3359. If the unit starts in a transport, then the transport may ferry
  3360. the unit over some of the intervening terrain,
  3361. possibly as far as the unit's destination.
  3362. A unit's basic movement rate is defined by its @dfn{speed},
  3363. which is a ratio of the the unit's acp.
  3364. A speed of 100% means that the unit can potentially
  3365. enter as many cells as it has acp,
  3366. while a speed of 20% means that the unit uses at least
  3367. 5 acp to enter a cell.
  3368. Movement can only succeed if several conditions are met:
  3369. the unit must be able to cross
  3370. the border terrain, the destination must be inside the world (but see below),
  3371. it must be able to exist on the terrain of the destination.
  3372. @deffn ActionType @code{move} x y z
  3373. This is the action that a unit performs to go from one location to another.
  3374. The destination must be within the @code{move-range} of the unit.
  3375. @end deffn
  3376. @deffn UnitTypeProperty @code{acp-to-move} acp
  3377. This property is the number of acp a unit uses to do one move action.
  3378. Defaults to @code{1}.
  3379. @end deffn
  3380. @deffn UnitTypeProperty @code{speed} n
  3381. This property is the basic multiplier relating acp to the number
  3382. of cells that may be entered during a turn.
  3383. Defaults to @code{100}.
  3384. @end deffn
  3385. @deffn UnitTypeProperty @code{speed-damage-effect} list@dots{}
  3386. Defaults to @code{()}.
  3387. @end deffn
  3388. @deffn Table @code{speed-occupant-effect} u1 u2 -> n%
  3389. This table is the percent change in the speed
  3390. of type @var{u1} for each occupant of type @var{u2}.
  3391. If the basic speed of @var{u1} is @code{0},
  3392. then the multiplication is performed
  3393. as if the speed were @code{1} instead.
  3394. Defaults to @code{100}.
  3395. @end deffn
  3396. @deffn UnitTypeProperty @code{speed-wind-effect} xxx
  3397. @end deffn
  3398. @deffn UnitTypeProperty @code{speed-wind-angle-effect} xxx
  3399. @end deffn
  3400. @deffn UnitTypeProperty @code{speed-min} mp
  3401. This property is the worst-case speed of a unit.
  3402. Defaults to @code{0}.
  3403. @end deffn
  3404. @deffn UnitTypeProperty @code{speed-max} mp
  3405. This property is the upper bound on a unit's movement in one turn.
  3406. Defaults to @code{0}.
  3407. @end deffn
  3408. @deffn UnitTypeProperty @code{move-range} n
  3409. This property is the maximum distance allowed to the destination cell.
  3410. Defaults to @code{1}.
  3411. @end deffn
  3412. The product of a unit's acp and its speed is its available @dfn{movement points}.
  3413. Any move between cells will cost at least one movement point.
  3414. Some mp costs may be negative, but the total mp for a move will always
  3415. be at least 1.
  3416. @deffn Table @code{mp-to-leave-terrain} u t -> mp
  3417. This table is the mp cost to leave a cell of type @var{t}.
  3418. If @var{t} is a border type, this cost is never used.
  3419. If @var{t} is a connection type, this cost is the cost of leaving the
  3420. connection terrain for the open terrain of the cell.
  3421. If @var{t} is a coating type, then this value adds to the cost
  3422. of leaving the cell.
  3423. Defaults to @code{0}.
  3424. @end deffn
  3425. @deffn Table @code{mp-to-enter-terrain} u t -> mp
  3426. This table is the mp cost to enter a cell of type @var{t}.
  3427. If @var{t} is a border type, this cost is the
  3428. cost of crossing the border.
  3429. If @var{t} is a connection type, this cost is the cost of entering the
  3430. connection terrain from the open terrain of the cell.
  3431. If @var{t} is a coating type, then this value adds to the cost
  3432. of entering the cell.
  3433. Defaults to @code{1}.
  3434. @end deffn
  3435. @deffn Table @code{mp-to-traverse} u t -> mp
  3436. This table gives the cost to travel
  3437. along a connection or border of the given type.
  3438. (note that the other costs are irrelevant if
  3439. unit starts and ends its movement on the connection).
  3440. A special type of move known as a @dfn{border slide} can occur when the
  3441. endpoints of a border touch on the start and destination cells.
  3442. Sliding works like normal movement
  3443. that happens to end up on a nonadjacent cell.
  3444. Same rules for permissibility apply.
  3445. If the value is negative, then border sliding is not possible.
  3446. Defaults to @code{1}.
  3447. @end deffn
  3448. If both enter/traverse/leave and enter/leave movement is possible,
  3449. then @i{Xconq} will automatically choose the cheapest alternative.
  3450. Each unit type has a range of altitudes within which it normally operates.
  3451. @deffn Table @code{altitude-min} u t -> n
  3452. This table is the minimum altitude possible for each type of unit
  3453. on each type of terrain.
  3454. Defaults to @code{0}.
  3455. @end deffn
  3456. @deffn Table @code{altitude-max} u t -> n
  3457. This table is the maximum altitude possible for each type of unit
  3458. on each type of terrain.
  3459. Defaults to @code{0}.
  3460. @end deffn
  3461. @deffn UnitTypeProperty @code{mp-to-leave-world} mp
  3462. This property is an additional move cost to leave the world entirely.
  3463. To leave, the unit must be within its @code{move-range} of an edge,
  3464. and have sufficient mp to move into the terrain in the edge cell
  3465. designated as the destination of the move.
  3466. If the value is @code{-1}, then the unit may never leave.
  3467. Defaults to @code{-1}.
  3468. @end deffn
  3469. @deffn UnitTypeProperty @code{free-mp} mp
  3470. This property is the amount by which the move points can ``go into the red''
  3471. and still allow one more move.
  3472. Defaults to @code{0}.
  3473. @end deffn
  3474. ZOC is exerted only over units out in the open, has no effect on occupants,
  3475. unless they leave their transport.
  3476. Occupants can themselves exert a ZOC,
  3477. if @code{occupant-can-fight} is true.
  3478. ZOC applies to all units on a hostile side.
  3479. @deffn Table @code{zoc-range} u1 u2 -> dist
  3480. This table is the maximum distance at which type @var{u1}
  3481. exerts a ZOC over type @var{u2}.
  3482. A value of @code{0} means that the unit controls only its own cell,
  3483. and a value of @code{-1} means that the unit does not exert a ZOC at all.
  3484. Defaults to @code{0}.
  3485. @end deffn
  3486. @deffn Table @code{zoc-into-terrain} u t -> t/f
  3487. This table is @code{true} if the unit exerts its ZOC into terrain @var{t}.
  3488. Defaults to @code{true}.
  3489. @end deffn
  3490. @deffn Table @code{zoc-from-terrain-effect} u t -> n
  3491. Defaults to @code{100}.
  3492. @end deffn
  3493. @deffn Table @code{mp-to-enter-zoc} u1 u2 -> mp
  3494. This table specifies extra movement points needed to enter the ZOC.
  3495. @code{-1} prevents entry entirely.
  3496. Defaults to @code{-1}.
  3497. @end deffn
  3498. @deffn Table @code{mp-to-leave-zoc} u1 u2 -> mp
  3499. This table specifies extra movement points needed to leave the ZOC.
  3500. @code{-1} prevents departure entirely.
  3501. Defaults to @code{0}.
  3502. @end deffn
  3503. @deffn Table @code{mp-to-traverse-zoc} u1 u2 -> mp
  3504. This table specifies extra movement points needed to move within the ZOC.
  3505. @code{-1} prevents traversing entirely.
  3506. Defaults to @code{0}.
  3507. @end deffn
  3508. If multiple units exert a ZOC into the same cell, then the mp cost
  3509. is the maximum of the different ZOC costs.
  3510. Units may use up some of their materials when they move.
  3511. Consumption happens after the move action, and only for successful moves.
  3512. @deffn Table @code{material-to-move} u m -> n
  3513. This table is the amount of each material that a unit of type @var{u}
  3514. must have in order to be able to move.
  3515. Defaults to @code{0}.
  3516. @end deffn
  3517. @deffn Table @code{consumption-per-move} u m -> n
  3518. This table is the amount of each material used by a unit to do one move action.
  3519. The amount taken is independent of terrain.
  3520. If the unit has less than the required amount of any of these materials,
  3521. it is immobilized until it gets more (this is tested before each move
  3522. action; note that this does not affect any other action, including
  3523. entering and leaving transports).
  3524. Defaults to @code{0}.
  3525. @end deffn
  3526. @node Entry Action, Research Action, Movement Action, Actions
  3527. @subsection Entry Action
  3528. Units can be inside other units, and have units inside them, in a
  3529. tree-like fashion.  There is no limit on the depth of the tree,
  3530. but most occupant-transport relationships have other limits.
  3531. @deffn ActionType @code{enter} unit
  3532. This is the action to enter the given @var{unit}.
  3533. @end deffn
  3534. @deffn UnitTypeProperty @code{acp-to-enter-unit} acp
  3535. This property is the number of acp a unit uses to do one entry action.
  3536. Defaults to @code{1}.
  3537. @end deffn
  3538. @deffn Table @code{can-enter-independent} u1 u2 -> t/f
  3539. This table is true if a unit @var{u1} can enter an independent unit @var{u2}.
  3540. Defaults to @code{false}.
  3541. @end deffn
  3542. Entering and leaving incur mp costs as does movment,
  3543. but units with a speed of 0 may enter and leave transports.
  3544. @deffn Table @code{mp-to-enter-unit} u1 u2 -> n
  3545. This table is the extra movement points required for @var{u1}
  3546. to enter the transport @var{u2},
  3547. and vice versa (i.e. how much of transport's time is consumed by the process).
  3548. Defaults to @code{0}.
  3549. @end deffn
  3550. @deffn Table @code{mp-to-leave-unit} u1 u2 -> n
  3551. Similar to entry cost.
  3552. Defaults to @code{0}.
  3553. @end deffn
  3554. Note that these mp consumptions need not be symmetrical
  3555. between occupant and transport,
  3556. so for instance a passenger can use 2 of its mp to get on a transport,
  3557. while costing the transport only one of its mp.
  3558. @deffn Table @code{ferry-on-entry} u1 u2 -> ferry-type
  3559. @end deffn
  3560. @deffn Table @code{ferry-on-departure} u1 u2 -> ferry-type
  3561. This table specifies how much intervening terrain the unit @var{u2}
  3562. entering or leaving transport @var{u1}
  3563. will have to cross on its own (and thus incur the terrain's mp costs and
  3564. limitations).
  3565. Defaults to @code{over-border}.
  3566. @end deffn
  3567. @deffn GlobalConstant @code{over-nothing}
  3568. This constant indicates no ferrying,
  3569. occupant must pay all costs to go to destination cell.
  3570. @end deffn
  3571. @deffn GlobalConstant @code{over-own}
  3572. This constant indicates that the transport ferries over terrain
  3573. of its own cell.
  3574. @end deffn
  3575. @deffn GlobalConstant @code{over-border}
  3576. This constant indicates that the transport ferries over any
  3577. border terrain also.
  3578. @end deffn
  3579. @deffn GlobalConstant @code{over-all}
  3580. This constant indicates that the transport ferries to destination cell,
  3581. effectively putting occupant on middle of cell,
  3582. on connection terrain if necessary.
  3583. @end deffn
  3584. @node Research Action, Toolup Action, Entry Action, Actions
  3585. @subsection Research Action
  3586. Research is an action performed by a unit with the sole effect
  3587. of increasing its side's tech level.
  3588. Research cannot be performed by independent units.
  3589. @deffn ActionType @code{research} u
  3590. This is the action of researching the unit type @var{u}.
  3591. If the action is valid, then the tech level of the side
  3592. will increase.
  3593. Unit types with any tech crossover will also have their tech
  3594. levels adjusted.
  3595. @end deffn
  3596. @deffn UnitTypeProperty @code{acp-to-research} acp
  3597. This property is the number of action points used up by one research action.
  3598. Defaults to @code{0}, which disallows research.
  3599. @end deffn
  3600. @deffn Table @code{tech-per-research} u1 u2 -> .01n
  3601. This table is the gain in tech level resulting from a research action, expressed as
  3602. 1/100 of a level.  Gains of less than 100 are probabilistic [should describe
  3603. this concept in general, used by several parms]
  3604. Defaults to @code{0}.
  3605. @end deffn
  3606. @deffn UnitTypeProperty @code{tech-per-turn-max} tl
  3607. This property is a ceiling on the total gain of tech level possible in one turn
  3608. for each side and this unit type.
  3609. Defaults to @code{9999}.
  3610. @end deffn
  3611. @node Toolup Action, Unit Creation Actions, Research Action, Actions
  3612. @subsection Toolup Action
  3613. There are several stages in the construction of a unit: tooling up,
  3614. creation, and completion.  Tooling up is where the building unit
  3615. prepares to build, creation is the step where the new unit comes into
  3616. existence, and completion is where the new unit is brought up to being
  3617. operational.
  3618. For the player, this is mostly automatic; if tooling must be
  3619. done first, a user command to build will generate the appropriate actions.
  3620. Once the technology has been achieved, a unit that intends to construct
  3621. other units may need to tool up.
  3622. This is expressed as @dfn{tool points} or @dfn{tp}.
  3623. Tool points start at zero, can be increased by tooling actions,
  3624. and may gradually decline (representing wear and tear on the equipment).
  3625. @deffn ActionType @code{toolup} u
  3626. This is the action of tooling up to build a unit of type @code{u}.
  3627. The result is an increase in the tp for the acting unit.
  3628. @end deffn
  3629. @deffn UnitTypeProperty @code{acp-to-toolup} acp
  3630. This property gives the number of acp needed to do a toolup action.
  3631. Defaults to @code{0}, which disallows tooling up.
  3632. @end deffn
  3633. @deffn Table @code{tp-per-toolup} u1 u2 -> tp
  3634. This table is the number of tp gained by one tooling action.
  3635. Defaults to @code{0}.
  3636. @end deffn
  3637. @deffn Table @code{tp-to-build} u1 u2 -> tp
  3638. This table is the number of toolup points needed before a unit of type @var{u1}
  3639. can create or build a unit of type @var{u2}.
  3640. Defaults to @code{0}.
  3641. @end deffn
  3642. @deffn Table @code{tp-max} u1 u2 -> tp
  3643. This table is the maximum possible tooling.
  3644. Defaults to @code{0}.
  3645. @end deffn
  3646. @deffn Table @code{tp-attrition} u1 u2 -> tp
  3647. This table is the number of .01 tool points automatically lost at
  3648. the end of each turn.
  3649. Defaults to @code{0}.
  3650. @end deffn
  3651. @deffn Table @code{tp-crossover} u1 u2 -> n%
  3652. This table is the effective number of tool points for @var{u2} that is
  3653. guaranteed to exist, expressed as a percentage of the tool
  3654. points for @var{u1}.
  3655. [copy tech-crossover description here]
  3656. Defaults to @code{0}.
  3657. @end deffn
  3658. @node Unit Creation Actions, Unit Completion Action, Toolup Action, Actions
  3659. @subsection Unit Creation Actions
  3660. When a constructing unit is tooled up, the build action creates a unit
  3661. immediately and puts it in its designated location, whether inside the
  3662. unit doing the building or somewhere nearby.  This new unit, however, is
  3663. incomplete, representing the keel of the ship or the surveyor's
  3664. lines for an airstrip.  Incomplete units are thus basically skeletons,
  3665. with some unit characteristics, but unable to move or act in any way.
  3666. They also cannot have any occupants, unless the occupants are of a type
  3667. that can complete the unit.  Those occupants do not derive any protection
  3668. or other advantages from occupying the incomplete unit, and they are not
  3669. affected by the @code{occupant-can-build} limitation. 
  3670. @deffn ActionType @code{create-in} u unit
  3671. This action creates a new unit of type @var{u} occupying the given
  3672. unit @var{unit}.
  3673. The unit @var{unit} must have room for the new unit.
  3674. @end deffn
  3675. @deffn ActionType @code{create-at} u x y z
  3676. This action creates a new unit of type @var{u} in the open at
  3677. @var{x,y,z}.
  3678. The cell must have room for this new unit.
  3679. @end deffn
  3680. @deffn Table @code{acp-to-create} u1 u2 -> acp
  3681. This table is the acp used by a unit of type @var{u1}
  3682. to create a a unit of type @var{u2}.
  3683. If zero, then @var{u1} cannot create a @var{u2}.
  3684. Defaults to @code{0}.
  3685. @end deffn
  3686. @deffn Table @code{create-range} u1 u2 -> dist
  3687. This table is the maximum distance at which a unit of type @var{u1}
  3688. can create a unit of type @var{u2}.
  3689. Defaults to @code{0}.
  3690. @end deffn
  3691. @deffn Table @code{cp-on-creation} u1 u2 -> cp
  3692. This table is the completeness of a unit of type @var{u2} when
  3693. created by a unit of type @var{u1}.
  3694. Defaults to @code{1}.
  3695. @end deffn
  3696. @deffn Table @code{material-to-create} u m -> n
  3697. This table is the total amount of a material type @var{m}
  3698. needed to create a unit of type @var{u}.
  3699. Defaults to @code{0}.
  3700. @end deffn
  3701. @deffn Table @code{consumption-on-creation} u m -> n
  3702. This table is the amount of a material type @var{m}
  3703. consumed to create a unit of type @var{u}.
  3704. Defaults to @code{0}.
  3705. @end deffn
  3706. @deffn Table @code{supply-on-creation} u m -> n
  3707. This table is the amount of supply of each material type @var{m}
  3708. to give a newly created unit of type @var{u}.
  3709. This supply is newly generated, does not come from anywhere else.
  3710. (Note that players could cheat by creating units, taking their supply,
  3711. and never completing them.)
  3712. Defaults to @code{0}.
  3713. @end deffn
  3714. @node Unit Completion Action, Repair Action, Unit Creation Actions, Actions
  3715. @subsection Unit Completion Action
  3716. Once an incomplete unit has been created,
  3717. other units can help to complete it.
  3718. @deffn ActionType @code{build} unit
  3719. This action adds to the completeness of @var{unit}.
  3720. If the unit becomes complete, it will be given its initial supply,
  3721. acp, name, etc.
  3722. @end deffn
  3723. @deffn Table @code{acp-to-build} u1 u2 -> acp
  3724. This table is the acp used up by one build action by a unit of type @var{u1}
  3725. when buiding a unit of type @var{u2}.
  3726. Defaults to @code{0}.
  3727. @end deffn
  3728. @deffn Table @code{cp-per-build} u1 u2 -> cp
  3729. This table is the amount of completeness of a unit of type @var{u2}
  3730. added by each completion action performed by a unit of type @var{u1}.
  3731. If @code{0}, then @var{u1} cannot contribute to completing @var{u2}.
  3732. Defaults to @code{1}.
  3733. @end deffn
  3734. @deffn Table @code{material-to-build} u m -> n
  3735. This table is the amount of each material type @var{m}
  3736. that @var{u} must have in order to build anything at all.
  3737. Defaults to @code{0}.
  3738. @end deffn
  3739. @deffn Table @code{consumption-per-build} u m -> n
  3740. This table is the amount of each material type @var{m}
  3741. consumed by @var{u} when doing a build action.
  3742. Defaults to @code{0}.
  3743. @end deffn
  3744. @deffn Table @code{build-range} u1 u2 -> dist
  3745. This table is the maximum distance allowed between a unit of type @var{u1}
  3746. and the incomplete unit of type @var{u2} it is working on.
  3747. Defaults to @code{0}, which requires the two units to be in
  3748. the same cell.
  3749. @end deffn
  3750. At a given point, incomplete units can make progress towards
  3751. completion on their own.  This is automatic because incomplete
  3752. units are unable to act, and occurs at a constant specified rate.
  3753. @deffn UnitTypeProperty @code{cp-to-self-build} cp
  3754. This property is the minimum completeness of the unit necessary before it
  3755. can work on itself.
  3756. Defaults to @code{0}.
  3757. @end deffn
  3758. @deffn UnitTypeProperty @code{cp-per-self-build} cp
  3759. This property is the completeness added each turn when a unit works on itself.
  3760. Defaults to @code{0}.
  3761. @end deffn
  3762. @deffn Table @code{supply-on-completion} u m -> n
  3763. This table is the minimum amount of supply of each material type @var{m}
  3764. guaranteed to a newly completed unit of type @var{u}.
  3765. If not already available to the unit, it will be newly generated.
  3766. Defaults to @code{0}.
  3767. @end deffn
  3768. @node Repair Action, Material Production Action, Unit Completion Action, Actions
  3769. @subsection Repair Action
  3770. Units can restore their own and each other's hp by doing repairs.
  3771. Repair requires a repair action.
  3772. The action points for this action
  3773. are taken from both the unit being repaired and
  3774. the repairer (using the same table @code{acp-to-repair}).
  3775. When a unit repairs itself, the action cost is counted once only.
  3776. @deffn ActionType @code{repair} unit
  3777. This is the action of repairing the given @var{unit}.
  3778. @end deffn
  3779. @deffn Table @code{acp-to-repair} u1 u2 -> acp
  3780. This table is the number of action points used up
  3781. by a unit of type @var{u1}
  3782. doing one repair action on a unit of type @var{u2}.
  3783. Defaults to @code{0}, which disallows the action.
  3784. @end deffn
  3785. @deffn Table @code{hp-per-repair} u1 u2 -> .01hp
  3786. This table is the hundredths of a hp that a single repair action
  3787. by a unit of type @var{u1} restores to a unit of type @var{u2}.
  3788. The fraction of this over 100 is added to hp directly,
  3789. while the < 100 fraction is added probabilistically.
  3790. (For example, a value of 160 means that 1 hp will be added for
  3791. each action, and there is a 60% chance that a second hp will
  3792. be added also.)
  3793. Defaults to @code{0}.
  3794. @end deffn
  3795. Materials may be needed and/or consumed during repair.
  3796. The materials will be taken from the
  3797. unit being repaired, then from the repairer.
  3798. @deffn Table @code{material-to-repair} u m -> .01n
  3799. This table is the amount of each material type @var{m} needed
  3800. for one repair action.
  3801. As with @code{hp-per-repair},
  3802. the < 100 part is average, and > 100 is guaranteed.
  3803. Defaults to @code{0}.
  3804. @end deffn
  3805. @deffn Table @code{consumption-per-repair} u m -> .01n
  3806. This table is the amount of each material type @var{m}
  3807. used up by a repair action.
  3808. @end deffn
  3809. The repairing unit must also not be too damaged itself to do repairs.
  3810. @deffn Table @code{hp-to-repair} u1 u2 -> hp
  3811. This table is the minimum hp level required of a unit of type @var{u1}
  3812. to repair a unit of type @var{u2}.
  3813. If less, then @var{u1} is too damaged to do any repairing.
  3814. Defaults to @code{1}, which allows repair always.
  3815. @end deffn
  3816. (The following are not really part of the repair action definition, since
  3817. they occur automatically.)
  3818. @deffn Table @code{auto-repair} u1 u2 -> .01hp
  3819. This table is the amount of repair (in 1/100 hp) that @var{u1} will do
  3820. on any unit of type @var{u2} within range (@code{auto-repair-range}).
  3821. As with @code{hp-per-repair},
  3822. the < 1.00 part is average, and > 1.00 is guaranteed.
  3823. Defaults to @code{0}, which disallows auto-repair.
  3824. @end deffn
  3825. @deffn Table @code{auto-repair-range} u1 u2 -> dist
  3826. This table is the distance out to which @var{u1} will auto-repair
  3827. any damaged @var{u2}.  A value of @code{0} requires the two units
  3828. to be in the same cell, while a value of @code{-1} means that
  3829. @var{u2} must be either an occupant or transport of @var{u1}.
  3830. Defaults to @code{0}.
  3831. @end deffn
  3832. @node Material Production Action, Material Transfer Action, Repair Action, Actions
  3833. @subsection Material Production Action
  3834. Units can produce materials by explicit action.
  3835. @deffn ActionType @code{produce} m
  3836. This action results in a quantity of material @var{m}
  3837. coming into existence.
  3838. @end deffn
  3839. @deffn Table @code{acp-to-produce} u m -> acp
  3840. This table is the acp used up by one @code{produce} action.
  3841. Defaults to @code{0}.
  3842. @end deffn
  3843. @deffn Table @code{material-per-production} u m -> n
  3844. This table is the amount of material produced by @var{u}
  3845. when acting to produce type @var{m}.
  3846. Defaults to @code{0}.
  3847. @end deffn
  3848. @deffn Table @code{material-to-produce} u m -> .01n
  3849. @end deffn
  3850. @node Material Transfer Action, Side Change Action, Material Production Action, Actions
  3851. @subsection Material Transfer Action
  3852. Although most movement of materials between units happens automatically
  3853. (see backdrop economy description, section xxx),
  3854. players can also do it explicitly.
  3855. Players can both take materials from other units, and give a unit's
  3856. materials to others.
  3857. @deffn ActionType @code{transfer} unit m n
  3858. This is the action of transferring supply to the given unit @var{unit}.
  3859. The desired amount is @var{n};  if @var{m} is a valid material type,
  3860. then only that type will be transferred, otherwise the action will
  3861. transfer all types of materials possible.
  3862. The actual transfer amounts may be less than @var{n}.
  3863. [If @var{unit} is NULL, then is equiv to discarding material?]
  3864. @end deffn
  3865. @deffn Table @code{acp-to-unload} u1 m -> acp
  3866. @end deffn
  3867. @deffn Table @code{acp-to-load} u1 m -> acp
  3868. These tables are the number of action points used up by one material transfer
  3869. action from @var{u1} to @var{u2}.
  3870. The amount is independent of the material type being transferred.
  3871. If either value is @code{0}, then the material cannot be transferred.
  3872. Defaults to @code{0}.
  3873. @end deffn
  3874. @deffn Table @code{unload-max} u1 m -> n
  3875. @end deffn
  3876. @deffn Table @code{load-max} u2 m -> n
  3877. These two tables determine how much of material @var{m} can be transferred out
  3878. of a unit of type @var{u1} and into one of type @var{u2}
  3879. in one transfer action.
  3880. The actual quantity transferred by the action
  3881. is the minimum of these two values.
  3882. A value of @code{0} disallows manual transfer.
  3883. Both default to @code{-1}, which allows any amount to be transferred.
  3884. @end deffn
  3885. @node Side Change Action, Disband Action, Material Transfer Action, Actions
  3886. @subsection Side Change Action
  3887. @deffn ActionType @code{change-side} side
  3888. This is the action of changing the actee's side to @var{side}.
  3889. The @var{side} can be any allowable side, and the actee
  3890. may be any unit controlled by the actor's side.
  3891. @end deffn
  3892. @deffn UnitTypeProperty @code{acp-to-change-side} acp
  3893. If the value of this property is greater than 0,
  3894. then this type of unit can be ordered to change to another given side.
  3895. The type must also be allowed to be on the new side.
  3896. Defaults to @code{0}.
  3897. @end deffn
  3898. @node Disband Action, Part Transfer Action, Side Change Action, Actions
  3899. @subsection Disband Action
  3900. Disbanding is the voluntary and controlled destruction of a unit,
  3901. performed by the unit itself or another unit.
  3902. A disbanded unit always vanishes, rather than changing to its
  3903. @code{wrecked-type}.
  3904. @deffn ActionType @code{disband} unit
  3905. This is the action of removing hp from @var{unit}.
  3906. The unit will vanish if all its hit points are gone.
  3907. @end deffn
  3908. @deffn Table @code{acp-to-disband} u1 u2 -> acp
  3909. This table is the number of action points used by the unit @var{u1} 
  3910. to do a disband action on unit @var{u2}.
  3911. Defaults to @code{0}.
  3912. @end deffn
  3913. @deffn UnitTypeProperty @code{hp-per-disband} hp
  3914. This table is the number of hp lost in a disband action.
  3915. Defaults to @code{0}, which disallows disbanding.
  3916. @end deffn
  3917. A disbanded unit can be scavenged for materials.
  3918. @deffn Table @code{supply-per-disband} u m -> n%
  3919. This table is the percentage of the unit's supply that is recovered
  3920. from a single disband action.
  3921. If the value is zero, then the unit's supply will not be
  3922. recovered by the disbanding process, and be lost permanently.
  3923. If any supply remains when the unit's hp is 0, then that
  3924. supply will be lost also.
  3925. Defaults to @code{100}, which means that the entire supply
  3926. will be recovered on the first disband action.
  3927. @end deffn
  3928. Note that if an essential supply is 100% recovered before the unit
  3929. is completely disbanded, then it may die from starvation first.
  3930. A partly-disbanded unit may still acquire supply
  3931. from nearby units, via the backdrop economy.
  3932. @deffn Table @code{recycleable-material} u m -> n
  3933. This table is the quantity of each type of material that becomes available
  3934. when a unit is completely disbanded.
  3935. The materials go to transports, occupants, and nearby units, in that order.
  3936. Any materials exceeding capacities of these units will be discarded.
  3937. These materials become available only when the unit vanishes.
  3938. Defaults to @code{0}.
  3939. @end deffn
  3940. @node Part Transfer Action, Type Change Action, Disband Action, Actions
  3941. @subsection Part Transfer Action
  3942. Units of variable size can transfer parts of themselves to other
  3943. units, or create a new unit.
  3944. @deffn ActionType @code{transfer-part} n unit
  3945. This action moves @var{n} parts of the actee to @var{unit},
  3946. or creates a new unit if @var{unit} is omitted.
  3947. If @var{n} is negative, this takes from @var{unit} instead.
  3948. If the action takes all the parts of any involved unit,
  3949. then it vanishes.
  3950. @end deffn
  3951. @deffn UnitTypeProperty @code{acp-to-transfer-part} acp
  3952. Defaults to @code{0}.
  3953. @end deffn
  3954. @node Type Change Action, Combat Actions, Part Transfer Action, Actions
  3955. @subsection Type Change Action
  3956. @deffn ActionType @code{change-type} u
  3957. @end deffn
  3958. @deffn Table @code{acp-to-change-type} u1 u2 -> acp
  3959. Defaults to @code{0}.
  3960. @end deffn
  3961. @deffn Table @code{material-to-change-type} u m -> n
  3962. Defaults to @code{0}.
  3963. @end deffn
  3964. @node Combat Actions, Capture Action, Type Change Action, Actions
  3965. @subsection Combat Actions
  3966. @i{Xconq} combat is somewhat abstract; the attacking player decides what sort
  3967. of attack to mount and perhaps when to retreat, but all else happens
  3968. automatically.
  3969. Combat may last longer than a single action;
  3970. it is then called a @dfn{battle} and divided into @dfn{rounds}.
  3971. The battle exists until one participant has a commitment of zero.
  3972. Units in a battle need not attack, and no damage will occur if none do so,
  3973. but they cannot move away until no longer committed.
  3974. The attacker/defender distinction applies only to a single action.
  3975. @deffn ActionType @code{attack} unit [commitment]
  3976. This action is a direct attack on the given @var{unit}.
  3977. The @var{unit} must be known to the attacking unit's side.
  3978. @end deffn
  3979. @deffn ActionType @code{overrun} x y z [commitment]
  3980. Overruns are a sort of combined attack/capture/move action.
  3981. The basic theory of an overrun is that the actor will attack,
  3982. capture, or co-occupy the given destination.
  3983. The exact effects depend on the types and sides of units in the destination.
  3984. @end deffn
  3985. @deffn Table @code{acp-to-attack} u1 u2 -> acp
  3986. This table is the number of action points used up by the attacker.
  3987. Defaults to @code{1}.
  3988. @end deffn
  3989. @deffn Table @code{acp-to-defend} u1 u2 -> acp
  3990. This table is the number of action points used up by the defender.
  3991. Defaults to @code{1}.
  3992. @end deffn
  3993. @deffn Table @code{attack-range-min} u1 u2 -> dist
  3994. This table is the minimum distance at which a unit can attack another.
  3995. Defaults to @code{0}.
  3996. @end deffn
  3997. @deffn Table @code{attack-range} u1 u2 -> dist
  3998. This table is the maximum distance at which a unit can attack another.
  3999. Defaults to @code{1}.
  4000. @end deffn
  4001. One round of combat consists of an attack, a reaction,
  4002. and a calculation of effects.
  4003. The defender's reaction is completely automatic, and occurs as part of the
  4004. attack action.  The defender's side does not get a chance to
  4005. decide what to do until the next round,
  4006. although doctrine can constrain the randomness somewhat.
  4007. @deffn Table @code{surrender-chance-per-attack} u1 u2 -> n%
  4008. This table is the chance that @var{u2} will surrender to @var{u1}
  4009. immediately upon being attacked.
  4010. Defaults to @code{0}.
  4011. @end deffn
  4012. @deffn Table @code{withdraw-chance-per-attack} u1 u2 -> n%
  4013. This table is the chance that @var{u2} will retreat from @var{u1}
  4014. immediately upon being attacked.
  4015. Defaults to @code{0}.
  4016. @end deffn
  4017. @deffn Table @code{acp-for-retreat} u1 u2 -> acp
  4018. This table is the extra acp that @var{u2} can get in order
  4019. to make a withdrawal possible.
  4020. Defaults to @code{0}.
  4021. @end deffn
  4022. In an overrun action,
  4023. if all the defending units are destroyed,
  4024. the attacker has sufficient acp and mp,
  4025. and the destination is safe to enter,
  4026. then the attacker can move into the defenders' cell.
  4027. Firing is a kind of attack that can take place at a distance,
  4028. involves no commitment or counterattack,
  4029. and for which the type of ammo may be selected.
  4030. @deffn ActionType @code{fire-at} unit [m]
  4031. This is the action of firing at a given @var{unit}.
  4032. If @var{m} is given, then that type will be used as ammo,
  4033. otherwise all available types will be used together.
  4034. @end deffn
  4035. @deffn ActionType @code{fire-into} x y [z] [m]
  4036. This is the action of firing into the cell at @var{x,y}.
  4037. If @var{z} is given, then the fire will be concentrated
  4038. on units at that elevation.
  4039. If @var{m} is given, then that type will be used as ammo,
  4040. otherwise all available types will be used together.
  4041. @end deffn
  4042. @deffn UnitTypeProperty @code{acp-to-fire} acp
  4043. If this property is greater than 0, this type may attack by firing.
  4044. Defaults to @code{0}.
  4045. @end deffn
  4046. @deffn Table @code{acp-to-be-fired-on} u1 u2 -> acp
  4047. This table is the acp lost when a unit is being fired upon.
  4048. Defaults to @code{1}.
  4049. @end deffn
  4050. @deffn UnitTypeProperty @code{range} dist
  4051. This property is the maximum distance to which a unit can fire.
  4052. Defaults to @code{1}.
  4053. @end deffn
  4054. @deffn UnitTypeProperty @code{range-min} dist
  4055. This property is the minimum distance to which a unit can fire.
  4056. Defaults to @code{0}.
  4057. @end deffn
  4058. @deffn UnitTypeProperty @code{elevation-at-max-range} dist
  4059. [elaborate calc to interpolate while rising and falling, basically
  4060. approximating a parabola]
  4061. @end deffn
  4062. Both attack and fire combat calculate hits and damage in the same way.
  4063. @deffn Table @code{hit-chance} u1 u2 -> n%
  4064. This table is the basic chance that a unit of type @var{u1} will
  4065. actually hit a unit of type @var{u2}.
  4066. If the hit chance is @code{0}, then the unit may never attack
  4067. or fire at a unit of that type.
  4068. Defaults to @code{0}.
  4069. @end deffn
  4070. @deffn Table @code{attack-terrain-effect} u1 t -> n%
  4071. @end deffn
  4072. @deffn Table @code{defend-terrain-effect} u2 t -> n%
  4073. These tables specify the
  4074. effect of attacker's and defender's respective terrains on
  4075. @code{hit-chance}.
  4076. These chances are multiplied with the basic hit chance.
  4077. Default to @code{100}.
  4078. @end deffn
  4079. @deffn Table @code{hit-cxp-effect} u1 u2 -> n
  4080. This table is the effect of combat experience on hit chance.
  4081. Its value is interpolated according to actual experience
  4082. (so that @var{n} is the effect when @var{u1} is at its maximum
  4083. experience), then multiplied with the hit chance.
  4084. Defaults to @code{100}.
  4085. @end deffn
  4086. @deffn Table @code{hit-falloff-range} u1 u2 -> n
  4087. This table is the maximum range at which the effectiveness of combat
  4088. is @i{not} affected by distance.
  4089. Defaults to @code{1}.
  4090. @end deffn
  4091. @deffn Table @code{hit-at-max-range-effect} u1 u2 -> n%
  4092. This is the multiplier for the effectiveness of combat at the
  4093. maximum range possible.
  4094. Defaults to @code{100}.
  4095. @end deffn
  4096. @deffn Table @code{damage} u1 u2 -> hp
  4097. This table is the basic amount of damage caused by a successful attack.
  4098. The value is a ``dice spec'' [explain somewhere]
  4099. Defaults to @code{1}.
  4100. @end deffn
  4101. The damage in an attack is always prorated by commitment;
  4102. the table value is for attacks at full commitment.
  4103. @deffn Table @code{damage-cxp-effect} u1 u2 -> n
  4104. This table is the effect of combat experience on damage.
  4105. Its value is interpolated according to actual experience
  4106. (so that @var{n} is the effect when @var{u1} is at its maximum
  4107. experience), then multiplied with both the dice size and the
  4108. addend of the damage spec.
  4109. Defaults to @code{100}.
  4110. @end deffn
  4111. @deffn Table @code{hp-min} u1 u2 -> hp
  4112. This table is the lowest hp possible for @var{u1} from attacks by @var{u2}.
  4113. Further attacks by @var{u2} are still valid, but have no effect.
  4114. Defaults to @code{0}.
  4115. @end deffn
  4116. You can set a unit to use a material as ammo.
  4117. @deffn Table @code{consumption-per-attack} u1 m -> n
  4118. @end deffn
  4119. @deffn Table @code{hit-by} u2 m -> n
  4120. These tables specify material consumption in combat.
  4121. For each material @code{m}, the min of these two values is the amount
  4122. of u1's supply used up in an attack on u2.
  4123. Both default to @code{0}.
  4124. @end deffn
  4125. @deffn Table @code{material-to-fight} u m -> n
  4126. This table is a minimum of each material that is necessary to either
  4127. attack or defend.
  4128. Defaults to @code{0}.
  4129. @end deffn
  4130. Transports can protect their occupants, and vice versa.
  4131. @deffn Table @code{protection} u1 u2 -> n%
  4132. @end deffn
  4133. Transport's destruction may leave occupants stranded on hex,
  4134. will do some sort of auto-escape or die if terrain is hostile.
  4135. [use ferry-on-leave to decide]
  4136. @deffn Table @code{stack-protection} u1 u2 -> n%
  4137. @end deffn
  4138. Several other side-effects of combat may also be defined.
  4139. @deffn Table @code{retreat-chance} u1 u2 -> n%
  4140. This table is the chance that @var{u2} will retreat if hit by @var{u1}.
  4141. Defaults to @code{0}.
  4142. @end deffn
  4143. @deffn Table @code{cxp-per-combat} u1 u2 -> cxp
  4144. This table is the number of combat experience points gained by @var{u1} 
  4145. by surviving a combat round with @var{u2}.
  4146. This applies equally to attackers and defenders.
  4147. Defaults to @code{0}.
  4148. @end deffn
  4149. @node Capture Action, Detonation Action, Combat Actions, Actions
  4150. @subsection Capture Action
  4151. A unit may attempt to capture another unit directly.
  4152. This means that the unit's side changes to that of the capturing unit.
  4153. @deffn ActionType @code{capture} unit
  4154. This is the action of capturing the given @var{unit}.
  4155. @end deffn
  4156. @deffn Table @code{acp-to-capture} u1 u2 -> acp
  4157. This table is the number of acp used up by a @code{capture} action.
  4158. Defaults to @code{0}, which disallows capture.
  4159. @end deffn
  4160. @deffn Table @code{capture-chance} u1 u2 -> n%
  4161. This table is the basic chance for @var{u1} to capture @var{u2}.
  4162. Defaults to @code{0}.
  4163. @end deffn
  4164. @deffn Table @code{independent-capture-chance} u1 u2 -> n%
  4165. This table is the basic chance for @var{u1} to capture an independent unit 
  4166. of type @var{u2}.  If the value is @code{-1}, then the chance of capture
  4167. is given by the @code{capture-chance}.
  4168. Defaults to @code{-1}.
  4169. @end deffn
  4170. @deffn Table @code{scuttle-chance} u t -> n%
  4171. This table is the chance that a unit whose capture is guaranteed will destroy
  4172. itself instead.  Scuttling is destructive, so unit changes to @code{wrecked-type}.
  4173. Occupants of an about-to-be-captured unit will also attempt to scuttle.
  4174. Defaults to @code{0}.
  4175. @end deffn
  4176. @deffn Table @code{occupant-escape-chance} u1 u2 -> n%
  4177. This table is the chance that an occupant @var{u1} will escape during the capture
  4178. of a unit of type @var{u2}.
  4179. Occupants that do not escape are either captured themselves or destroyed,
  4180. depending on their type and the capturing unit's side.
  4181. Defaults to @code{0}.
  4182. @end deffn
  4183. @deffn Table @code{hp-to-garrison} u1 u2 -> n
  4184. This table is the number of hp that will be taken from the capturing
  4185. unit @var{u1} in order to guard a captured @var{u2}.
  4186. If the amount is the unit's full hp, then the unit will vanish
  4187. and any occupants will be distributed to the captured unit, to open
  4188. terrain, or will vanish themselves if there is no other option.
  4189. Defaults to @code{0}.
  4190. @end deffn
  4191. @c @deffn Word {@var{bool unit2 unit @code{bridge}}}
  4192. @c True if the unit type @var{unit2} can be captured by another unit
  4193. @c @var{unit}, even across
  4194. @c impassable terrain.
  4195. @c @end deffn
  4196. @deffn Table @code{cxp-per-capture} u1 u2 -> ep
  4197. This table is the number of combat experience points gained by @var{u1} 
  4198. by capturing @var{u2}.
  4199. Defaults to @code{0}.
  4200. @end deffn
  4201. @deffn UnitTypeProperty @code{cxp-on-capture-effect} n
  4202. This property gives the change in a unit's cxp due to being captured,
  4203. expressed as a multiplier.
  4204. Defaults to @code{100}.
  4205. @end deffn
  4206. @node Detonation Action, Terrain Alteration Actions, Capture Action, Actions
  4207. @subsection Detonation Action
  4208. Detonation is an action and/or behavior that causes damage indiscriminately.
  4209. The action specifies the location of the detonation,
  4210. which may be in the unit's cell or an adjacent one.
  4211. A unit that detonates loses hp, changing to its @code{wrecked-type}
  4212. if it loses all of its hp.
  4213. It also hits every unit within a specified radius.
  4214. Detonation may also affect terrain within a specified radius.
  4215. @deffn ActionType @code{detonate} x y z
  4216. This action detonates the actee at the given location @var{x,y,z}.
  4217. @end deffn
  4218. @deffn UnitTypeProperty @code{acp-to-detonate} acp
  4219. This property is the number of action points used by one detonate action.
  4220. Defaults to @code{0}, which disallows detonation.
  4221. @end deffn
  4222. @deffn UnitTypeProperty @code{hp-per-detonation} hp
  4223. This property is the number of hp lost in each detonation.
  4224. Defaults to @code{0}.
  4225. @end deffn
  4226. @deffn Table @code{detonation-unit-range} u1 u2 -> dist
  4227. This table gives the range of effect from detonation of @var{u1}.
  4228. The severity falls off according to the inverse square law
  4229. extrapolated from the adjacent cell damage.
  4230. (1/4 severity at range 2, 1/9 at 3, etc.)
  4231. Defaults to @code{0}.
  4232. @end deffn
  4233. @deffn Table @code{detonation-damage-at} u1 u2 -> hp
  4234. This table is the severity of @var{u1}'s hit on a unit @var{u2} in the same cell.
  4235. Defaults to @code{0}.
  4236. @end deffn
  4237. @deffn Table @code{detonation-damage-adjacent} u1 u2 -> hp
  4238. This table is the severity of @var{u1}'s hit on a unit @var{u2} in an adjacent cell.
  4239. Defaults to @code{0}.
  4240. @end deffn
  4241. @deffn Table @code{detonation-terrain-range} u t -> dist
  4242. Defaults to @code{0}.
  4243. @end deffn
  4244. @deffn Table @code{detonation-terrain-damage-chance} u t -> n%
  4245. Defaults to @code{0}.
  4246. @end deffn
  4247. @deffn Table @code{terrain-damaged-type} t1 t2 -> n
  4248. Relative chance that terrain of type @var{t1} damaged by a detonation
  4249. will change into another type @var{t2}.
  4250. Defaults to @code{0}.
  4251. @end deffn
  4252. The following tables and properties can be used for units that cannot
  4253. detonate deliberately by doing a detonate action.
  4254. @deffn Table @code{detonate-on-hit} u1 u2 -> n%
  4255. This table is the chance that a hit on @var{u1}
  4256. by a unit of type @var{u2} will cause it to detonate (once).
  4257. Noncombat reductions in hp, such as attrition, have no effect.
  4258. Defaults to @code{0}.
  4259. @end deffn
  4260. @deffn UnitTypeProperty @code{detonate-on-death} n%
  4261. This property is the chance that if this type is about to die from a combat hit,
  4262. it will detonate first.
  4263. Defaults to @code{0}.
  4264. @end deffn
  4265. @deffn Table @code{detonate-on-capture} u1 u2 -> n%
  4266. This table is the chance that a unit of type @var{u1} will detonate if a capture
  4267. by a unit of type @var{u2} is about to succeed.
  4268. Defaults to @code{0}.
  4269. @end deffn
  4270. @deffn Table @code{detonate-on-approach-range} u1 u2 -> dist
  4271. When a unit of type @var{u2} on a non-trusted [?] side
  4272. appears at a distance of @var{dist}
  4273. or less, then @var{u1} will detonate.
  4274. If @code{-1}, then unit will not detonate upon approach.
  4275. Defaults to @code{-1}.
  4276. @end deffn
  4277. @deffn Table @code{detonation-accident-chance} u t -> n.f%
  4278. This table is the chance that the unit will detonate spontaneously.
  4279. This is checked once/turn, at the beginning of the turn, and also
  4280. upon each entry to a cell, if moving.
  4281. Defaults to @code{0}.
  4282. @end deffn
  4283. @node Terrain Alteration Actions,  , Detonation Action, Actions
  4284. @subsection Terrain Alteration Actions
  4285. @deffn ActionType @code{alter-terrain} x y t
  4286. This action changes the type of the cell at @var{x,y} to @var{t}.
  4287. @end deffn
  4288. @deffn ActionType @code{add-terrain} x y dir t
  4289. This action adds a connection or border of type @var{t}
  4290. to the cell at @var{x,y}, in direction @var{dir}.
  4291. @end deffn
  4292. @deffn ActionType @code{remove-terrain} x y dir t
  4293. This action removes a connection or border of type @var{t}
  4294. to the cell at @var{x,y}, in direction @var{dir}.
  4295. @end deffn
  4296. @deffn Table @code{acp-to-add-terrain} u t -> n
  4297. @end deffn
  4298. @deffn Table @code{acp-to-remove-terrain} u t -> n
  4299. For auxiliary terrain types, these tables are the costs to add or remove.
  4300. For cell terrain, the costs of removing the old type and adding the
  4301. new type are added together.
  4302. @end deffn
  4303. @deffn Table @code{alter-terrain-range} u t -> n
  4304. This table is the maximum distance at which a unit can alter terrain @var{t}.
  4305. Defaults to @code{0}, which means that the unit can change only the
  4306. terrain in its own cell.
  4307. @end deffn
  4308. At present, all sides that have seen the terrain once will be informed
  4309. about any changes.
  4310. @node Backdrop Environment Parameters, Backdrop Economy Parameters, Actions, Reference Manual
  4311. @section Backdrop Environment Parameters
  4312. This section describes how to set up backdrop computations.
  4313. @menu
  4314. * Random Environmental Variation::           
  4315. * Years and Days::              
  4316. * Seasonal Effects::  
  4317. * Weather Parameters::          
  4318. @end menu
  4319. @node Random Environmental Variation, Years and Days, Backdrop Environment Parameters, Backdrop Environment Parameters
  4320. @subsection Random Environmental Variation
  4321. Environmental conditions may be computed randomly.
  4322. @deffn TerrainTypeProperty @code{temperature-average} n
  4323. This property is the average temperature for each type of terrain.
  4324. Defaults to @code{0}.
  4325. @end deffn
  4326. @deffn TerrainTypeProperty @code{temperature-variability} n
  4327. This property is the amount of totally random variation
  4328. in the temperature in each cell.
  4329. Defaults to @code{0}.
  4330. @end deffn
  4331. @deffn TerrainTypeProperty @code{wind-force-average}
  4332. @end deffn
  4333. @deffn TerrainTypeProperty @code{wind-force-variability}
  4334. @end deffn
  4335. @deffn TerrainTypeProperty @code{wind-variability}
  4336. @end deffn
  4337. @deffn GlobalVariable @code{wind-mix-range}
  4338. This variable is the radius out to which winds interact.
  4339. If 0, then winds in adjacent cells can vary independently
  4340. of each other, and do not interact in any way.
  4341. Defaults to @code{0}.
  4342. @end deffn
  4343. @node Years and Days, Seasonal Effects, Random Environmental Variation, Backdrop Environment Parameters
  4344. @subsection Years and Days
  4345. @deffn WorldProperty @code{year-length} n
  4346. This property is the number of turns in an annual cycle.
  4347. If less than @code{2}, then no seasonal effects will be calculated.
  4348. Defaults to @code{0}.
  4349. @end deffn
  4350. @deffn WorldProperty @code{day-length} n
  4351. This property is the number of turns in a single day.
  4352. If less than @code{2}, then day and night will not be calculated.
  4353. Defaults to @code{0}.
  4354. @end deffn
  4355. Note that @code{year-length} and @code{day-length} are
  4356. completely independent of each other, and it is possible
  4357. to have days that are longer than years.
  4358. @deffn AreaProperty @code{initial-year-part} n
  4359. This property is the season of the first turn in the game.
  4360. Defaults to @code{0}.
  4361. @end deffn
  4362. @deffn AreaProperty @code{initial-day-part} n
  4363. This property is the hour of the first turn in the game.
  4364. Defaults to @code{0}.
  4365. @end deffn
  4366. [need amount of daylight, twilight, etc]
  4367. @deffn GlobalVariable @code{season-names} xxx
  4368. This global is a list of which turns in a year should be called
  4369. which seasons.  It has the form @code{(... (n1 n2 name) ...)}.
  4370. Defaults to @code{()}.
  4371. @end deffn
  4372. @node Seasonal Effects, Weather Parameters, Years and Days, Backdrop Environment Parameters
  4373. @subsection Seasonal Effects
  4374. @deffn UnitTypeProperty @code{acp-season-effect} xxx
  4375. This property is the effect of the seasons on acp.
  4376. This property is added to the basic @code{acp-per-turn}.
  4377. Defaults to @code{()}.
  4378. @end deffn
  4379. @deffn GlobalVariable @code{temperature-year-cycle} xxx
  4380. @end deffn
  4381. @node Weather Parameters, , Seasonal Effects, Backdrop Environment Parameters
  4382. @subsection Weather Parameters
  4383. While the seasons change relatively slowly and predictably,
  4384. weather can change drastically from turn to turn.
  4385. @c @i{Xconq} weather is based on a daily cycle of heating and cooling
  4386. @c plus the movement of water vapor.
  4387. @c Weather and seasons can be defined completely independently of each other.
  4388. @c The weather model assumes a constant basic temperature, set from
  4389. @c summer-equator if the season model is not being used.
  4390. @c Atmospheric vapor is modelled by having a vapor quantity in each cell
  4391. @c [define a layer for this].
  4392. @c Vapor originates with evaporation from terrain,
  4393. @c moves around with changing winds and air pressure,
  4394. @c and high levels result in clouds, rain, and snow.
  4395. @deffn TerrainTypeProperty @code{temperature-moderation-range} distance
  4396. This property is the radius of the area whose raw temperatures will be averaged
  4397. to get the actual temperature.
  4398. This can be very time-consuming to calculate,
  4399. so only values of 0 (no averaging)
  4400. and 1 (average with adjacent cells) are recommended.
  4401. Defaults to @code{0}.
  4402. @end deffn
  4403. @subsection Weather Effects
  4404. [effects of coating should be increased attrition, decreased
  4405. productivity, decreased activity and mobility]
  4406. @deffn UnitTypeProperty @code{acp-temperature-effect} xxx
  4407. This property is the effect of temperature on acp.
  4408. This property is multiplied with the final acp value (?).
  4409. Defaults to @code{()}.
  4410. @end deffn
  4411. @deffn UnitTypeProperty @code{consumption-temperature-effect} xxx
  4412. This property is the effect of temperature on material consumption.
  4413. Defaults to @code{()}.
  4414. @end deffn
  4415. @deffn UnitTypeProperty @code{temperature-attrition} xxx
  4416. This property is the effect of temperature on a unit's hp.
  4417. Defaults to @code{()}.
  4418. @end deffn
  4419. Transports can protect their occupants from temperature extremes.
  4420. @deffn Table @code{temperature-protection} u1 u2 -> t/f
  4421. @end deffn
  4422. The environmental conditions include temperature, coatings such as snow,
  4423. and atmospheric conditions.
  4424. [specify these]
  4425. The current environmental conditions in each cell
  4426. [or in world as a whole? or calc by regions?]
  4427. derive from a combination of three calculations:
  4428. random, seasons, and weather.
  4429. @node Backdrop Economy Parameters, Random Events, Backdrop Environment Parameters, Reference Manual
  4430. @section Backdrop Economy Parameters
  4431. The following parameters control the automatic production, distribution, and
  4432. consumption of materials by units and by cells.
  4433. @menu
  4434. * Unit Production and Consumption::  
  4435. * Terrain Production and Consumption::  
  4436. * Supply Lines::                
  4437. * Backdrop Trade::              
  4438. * Backdrop Taxation::           
  4439. * Material Conversion::         
  4440. @end menu
  4441. @node Unit Production and Consumption, Terrain Production and Consumption, , Backdrop Economy Parameters
  4442. @subsection Unit Production and Consumption
  4443. Units can be set to always produce some amount of material without
  4444. taking explicit action.
  4445. @deffn Table @code{base-production} u m -> n
  4446. This table is the basic amount of each material @var{m}
  4447. produced by a unit of type @var{u} in each turn.
  4448. Defaults to @code{0}.
  4449. @end deffn
  4450. @deffn Table @code{occupant-base-production} u m -> n
  4451. This table is the base production of each material @var{m}
  4452. when a unit of type @var{u} is an occupant.
  4453. Defaults to @code{0}.
  4454. @end deffn
  4455. @deffn Table @code{productivity} u t -> n%
  4456. This base is the percentage productivity of a unit
  4457. of type @var{u} when on terrain of type @var{t}.
  4458. This is multiplied with the basic production rate to get actual material
  4459. production, so productivity of @code{0} completely disables production on
  4460. that terrain type, and productivity of @code{100} yields the rate
  4461. specified by @code{base-production}.
  4462. Defaults to @code{100}.
  4463. @end deffn
  4464. @deffn Table @code{productivity-min} u m -> n
  4465. @end deffn
  4466. @deffn Table @code{productivity-max} u m -> n
  4467. These tables are the
  4468. lower and upper bounds on actual production after multiplying by
  4469. productivity.
  4470. Default to @code{0} and @code{9999}, respectively.
  4471. @end deffn
  4472. @deffn Table @code{base-consumption} u m -> n
  4473. This table
  4474. sets the amount of materials consumed by the unit in a turn, even if it
  4475. doesn't move or do anything else.
  4476. Defaults to @code{0}.
  4477. @end deffn
  4478. @deffn Table @code{hp-per-starve} u m -> hp
  4479. If the unit runs out of a material that it must consume,
  4480. this table specifies how many hp it will lose each turn that it is starving.
  4481. If starving for several reasons, loss is max of starvation losses,
  4482. not the sum.
  4483. Defaults to @code{0}.
  4484. @end deffn
  4485. @deffn Table @code{consumption-as-occupant} u m -> n%
  4486. This table is the consumption by a unit of type @var{u1} when it is
  4487. an occupant, expressed as a percentage of its @code{base-consumption}.
  4488. This is useful for units such as planes which always consume fuel
  4489. in the air but not on the ground.
  4490. Defaults to @code{100}.
  4491. @end deffn
  4492. @node Terrain Production and Consumption, Supply Lines, Unit Production and Consumption, Backdrop Economy Parameters
  4493. @subsection Terrain Production and Consumption
  4494. Materials may be produced by cells, redistributed, and also taken up
  4495. by units.  Some amount of material may need to stay in the cell's storage,
  4496. or the type of terrain might change.  Exhaustion is tested after all consumption
  4497. has been accounted for.
  4498. @deffn Table @code{terrain-production} t m -> n
  4499. This table is the amount of each material @var{m} produced by a cell of the given
  4500. type @var{t} in each turn.
  4501. Defaults to @code{0}.
  4502. @end deffn
  4503. @deffn Table @code{terrain-consumption} t m -> n
  4504. This table is the amount of material @var{m} consumed by a cell of type @var{t}
  4505. each turn.
  4506. If insufficient material is available, then the terrain may change type.
  4507. Defaults to @code{0}.
  4508. @end deffn
  4509. @deffn Table @code{change-on-exhaustion-chance} t m -> n%
  4510. This table is the chance that a cell of type @var{t}, with no supply of material
  4511. of type @var{m}, will become exhausted and change to its exhausted type.
  4512. @end deffn
  4513. @deffn Table @code{terrain-exhaustion-type} t1 m -> t2
  4514. If @var{t2} is not @code{non-terrain},
  4515. then this table says that any cell with terrain @var{t1}
  4516. that is exhausted will change to @var{t2}.
  4517. If several materials are
  4518. exhausted in the same turn, then the lowest-numbered material type
  4519. will determine the new terrain type.
  4520. Defaults to @code{non-terrain}.
  4521. @end deffn
  4522. @deffn Table @code{people-consumption} m1 m2 -> n
  4523. This table is the base consumption per turn
  4524. by people of type @var{m1} of each other material type @var{m2}.
  4525. Defaults to @code{0}.
  4526. @end deffn
  4527. @deffn Table @code{people-production} m1 m2 -> n
  4528. This table is the people of type @var{m1} base production per turn
  4529. of each other material type @var{m2}.
  4530. Defaults to @code{0}.
  4531. @end deffn
  4532. @node Supply Lines, Backdrop Trade, Terrain Production and Consumption, Backdrop Economy Parameters
  4533. @subsection Supply Lines
  4534. In real life, material production and consumption rarely occur in the same place
  4535. at the same time.
  4536. For some games, the player must transfer materials
  4537. manually, by loading and unloading from units.
  4538. However, this can be time-consuming and difficult,
  4539. and is best reserved for scarce and/or
  4540. valuable materials.
  4541. For more common materials, @i{Xconq} provides @dfn{supply lines}.
  4542. @deffn Table @code{in-length} u1 m -> dist
  4543. @end deffn
  4544. @deffn Table @code{out-length} u2 m -> dist
  4545. These two tables together determine the length of supply lines
  4546. between units.  The given type of material can only be transferred from
  4547. unit type @var{u1} to unit type @var{u2}
  4548. if the distance is less than the minimum of
  4549. the @code{in-length} of @var{u1} and the @code{out-length} of @var{u2}.
  4550. For instance, the @code{in-length} for a fighter's fuel might be 3 cells,
  4551. while the @code{out-length} of fuel from a city is 4 cells.
  4552. Then the fighter will be constantly supplied with fuel
  4553. when within 3 cells of a city.
  4554. If the fighter's out-length is -1, it will never
  4555. transfer any fuel to the city.
  4556. An in- or out-length of @code{0} means that the two units must be
  4557. in the same cell,
  4558. while a negative length disables the automatic transfer completely.
  4559. Long @code{out-length} lines should be used sparingly,
  4560. since the algorithm uses the @code{out-length} to
  4561. define a radius of search for units to be resupplied.
  4562. Both default to @code{0}.
  4563. @end deffn
  4564. @node Backdrop Trade, Backdrop Taxation, Supply Lines, Backdrop Economy Parameters
  4565. @subsection Backdrop Trade
  4566. [not yet implemented]
  4567. @c To move materials automatically between cells,
  4568. @c you must define the demand and supply relationships,
  4569. @c as well as the rate and distance that materials can move.
  4570. @c Demand for a material originates with consumption and
  4571. @c construction needs, issuing either from a side or from
  4572. @c some other part of the economy.
  4573. @node Backdrop Taxation, Material Conversion, Backdrop Trade, Backdrop Economy Parameters
  4574. @subsection Backdrop Taxation
  4575. [not yet implemented]
  4576. @c A side can set a taxation rate, which is the amount of material
  4577. @c that will be taken from the cell-based economy and given to units
  4578. @c on that side.
  4579. @c Taxes may be negative, which will have the effect of returning
  4580. @c materials from units back to cells.
  4581. @c Taxation is the last step in economic calculations.
  4582. @node Material Conversion,  , Backdrop Taxation, Backdrop Economy Parameters
  4583. @subsection Material Conversion
  4584. [not yet implemented]
  4585. @c Some types of materials can be converted or combined into other types
  4586. @c of materials.
  4587. @c [do by letting production vary according to consumption?]
  4588. @c [in general, should distinguish productive from consumptive units,
  4589. @c specify as limits on in/out for each rtype]
  4590. @node Random Events, Dates and Time, Backdrop Economy Parameters, Reference Manual
  4591. @section Random Events
  4592. @deffn GlobalVariable @code{random-events} method-list
  4593. This variable is a list of random event methods
  4594. that will be run at the end of each turn.
  4595. The list is not ordered.
  4596. @end deffn
  4597. @menu
  4598. * Terrain Attrition::           
  4599. * Terrain Accident::            
  4600. * Unit Revolt::                 
  4601. * Unit Surrender::              
  4602. @end menu
  4603. @node Terrain Attrition, Terrain Accident, Random Events, Random Events
  4604. @subsection Terrain Attrition
  4605. Attrition is the automatic loss of hit points due to being in certain types
  4606. of terrain.
  4607. @deffn Method @code{attrition-in-terrain}
  4608. For every unit not in a transport,
  4609. this method computes the chance to lose hit points,
  4610. then damages the unit accordingly.
  4611. This method runs once per turn.
  4612. @end deffn
  4613. @deffn Table @code{attrition} u t -> .01hp
  4614. This table is the rate of loss of hp per turn.
  4615. The terrain used is cell or connection terrain as appropriate for
  4616. the unit's position.
  4617. Defaults to @code{0}.
  4618. @end deffn
  4619. @node Terrain Accident, Unit Revolt, Terrain Attrition, Random Events
  4620. @subsection Terrain Accident
  4621. Accidents result in the damage or disappearance of a unit in the open
  4622. in some kinds of terrain.
  4623. @deffn Method @code{accidents-in-terrain}
  4624. For every unit not in a transport,
  4625. this method computes the chance to be hit or to vanish completely.
  4626. This method runs once per turn.
  4627. @end deffn
  4628. @deffn Table @code{accident-hit-chance} u t -> .01n%
  4629. This table is the chance of the unit being hit while in the given terrain.
  4630. Defaults to @code{0}.
  4631. @end deffn
  4632. @deffn Table @code{accident-damage} u t -> hp
  4633. This table is the hp that will be lost in an accident.
  4634. Defaults to @code{0}.
  4635. @end deffn
  4636. @deffn Table @code{accident-vanish-chance} u t -> .01n%
  4637. This table is the chance of the unit simply vanishing while in the given terrain.
  4638. Defaults to @code{0}.
  4639. @end deffn
  4640. @node Unit Revolt, Unit Surrender, Terrain Accident, Random Events
  4641. @subsection Unit Revolt
  4642. Revolt is a spontaneous change of side,
  4643. occurring in place of a side-given unit action.
  4644. The new side may be none (independence) or another side.
  4645. [only if other side wants it?] [50/50 chance?]
  4646. @deffn Method @code{units-revolt}
  4647. For each completed unit, this method decides whether the unit revolts,
  4648. then changes its side.
  4649. @end deffn
  4650. @deffn UnitTypeProperty @code{revolt-chance} .01n%
  4651. This property is the chance for the unit to revolt spontaneously.
  4652. Defaults to @code{0}.
  4653. @end deffn
  4654. @node Unit Surrender, , Unit Revolt, Random Events
  4655. @subsection Unit Surrender
  4656. @deffn Method @code{units-surrender}
  4657. For each completed unit, this method checks whether the unit will surrender
  4658. to a nearby unfriendly unit.
  4659. @end deffn
  4660. @deffn Table @code{surrender-chance} u1 u2 -> .01n%
  4661. This table is the chance that a unit of type @var{u1} will change its side
  4662. to match the side of a unit @var{u2} that is within the @code{surrender-range}
  4663. for the two types.
  4664. Defaults to @code{0}.
  4665. @end deffn
  4666. @deffn Table @code{surrender-range} u1 u2 -> dist
  4667. This table is the distance out to which a unit of type @var{u1}
  4668. will surrender to a unit of type @var{u2}.
  4669. Defaults to @code{1}.
  4670. @end deffn
  4671. @node Dates and Time, Image Families, Random Events, Reference Manual
  4672. @section Dates and Time
  4673. @deffn GlobalVariable @code{turn} n
  4674. This variable is the number of the current turn.
  4675. Defaults to @code{0}.
  4676. @end deffn
  4677. Note that the first turn of a game is actually turn 1.
  4678. Pre-game activities happen during ``turn 0''.
  4679. @menu
  4680. * Game Length::
  4681. * Calendar::
  4682. * Real Time::                   
  4683. @end menu
  4684. @node Game Length, Calendar, Dates and Time, Dates and Time
  4685. @subsection Game Length
  4686. @deffn GlobalVariable @code{last-turn} n
  4687. This variable is the number
  4688. of the last turn.
  4689. Defaults to @code{-1}, which means that there is no limit on the number
  4690. of turns.
  4691. @end deffn
  4692. @deffn GlobalVariable @code{extra-turn-chance} n%
  4693. This variable is the chance that the game will go one more turn
  4694. after the @code{last-turn}.
  4695. @end deffn
  4696. @i{Xconq} is currently limited to games of 32,767 turns.
  4697. @node Calendar, Real Time, Game Length, Dates and Time
  4698. @subsection Calendar
  4699. You can make @i{Xconq} display game time as a calendar date,
  4700. rather than as a simple turn number.
  4701. @deffn GlobalVariable @code{calendar} type data@dots{}
  4702. This variable is the description of the calendar type that will be used.
  4703. If @code{none}, then turns will be reported numerically starting
  4704. from @code{1}.  If @code{usual}, then the standard Gregorian
  4705. calendar will be used.
  4706. (Other calendars may be supported in the future.)
  4707. Defaults to @code{()}, which is equivalent to @code{(number "turn")}.
  4708. For the @code{usual} calendar, the @var{data} defines how long a turn is,
  4709. in terms of the calendar.
  4710. For instance, a time measure of @code{"day"}
  4711. (and a base date of @code{"1 Jan 1900"}) will result in turns
  4712. @code{"1 Jan 1900"}, @code{"2 Jan 1900"}, etc,
  4713. while a date unit of @code{"year"}
  4714. will yield just @code{"1900"}, @code{"1901"}, and so forth.
  4715. If the numeric or @code{number} calendar is in use, then a @var{data} of @code{"day"}
  4716. will yield @code{"day 1"}, @code{"day 2"}, etc.
  4717. The rest of this variable lists the name of each season
  4718. and the turns within a year for which it is appropriate.
  4719. A twelve-turn year with four seasons could be
  4720. @example
  4721. ((0 2 "winter") (3 5 "spring") (6 8 "summer") (9 11 "autumn"))
  4722. @end example
  4723. If any number ranges overlap, then the first match will be used,
  4724. while if a particular turn has no named season, then it will go
  4725. unnamed in the display.
  4726. @end deffn
  4727. @deffn Symbol @code{none}
  4728. @end deffn
  4729. @deffn Symbol @code{usual}
  4730. @end deffn
  4731. @deffn GlobalVariable @code{initial-date} str
  4732. This variable is the date, in the specified calendar system, of the first turn.
  4733. Defaults to @code{""}, which has the effect of setting the initial date
  4734. to be whatever the calendar does with turn number 1.
  4735. @end deffn
  4736. @node Real Time, , Calendar, Dates and Time
  4737. @subsection Real Time
  4738. A game may also be limited in real time.
  4739. @deffn GlobalVariable @code{real-time-for-game} seconds
  4740. @end deffn
  4741. @deffn GlobalVariable @code{real-time-per-turn} seconds
  4742. @end deffn
  4743. @deffn GlobalVariable @code{real-time-per-side} seconds
  4744. @end deffn
  4745. @deffn GlobalVariable @code{elapsed-real-time} seconds
  4746. This is the difference in real time between the start of the game
  4747. and its current state.
  4748. @end deffn
  4749. @node Image Families, Other Forms, Dates and Time, Reference Manual
  4750. @section Image Families
  4751. The @code{imf} form defines graphical images in a
  4752. platform-independent way.
  4753. An @i{image family} is a named collection of images of varying
  4754. sizes and depths.
  4755. @deffn Form @code{imf} name [properties] [images]
  4756. This form declares an image family to exist, with the name @var{name}
  4757. and @var{properties}, and consisting of the specified @var{images}.
  4758. Each image has the form
  4759. @code{((@var{w} @var{h} [tile]) [@var{properties}] (@var{type} @var{data}...) ...)},
  4760. where @var{w} and @var{h} are its width and height, respectively,
  4761. the @var{type} may be one of @code{color}, @code{mono}, or @code{mask},
  4762. and the @var{data} consists of strings of hexadecimal digits.
  4763. The data strings may include slashes, which have no effect on interpretation,
  4764. but are useful to indicate each row of an image.
  4765. Color images may also have additional properties, which come between the
  4766. @var{type} and the @var{data}.
  4767. Multiple forms with the same name may occur, and each adds to the family,
  4768. overwriting individual image parts that are of the same size and depth.
  4769. @end deffn
  4770. @deffn Symbol @code{tile}
  4771. If this symbol appears following the dimensions of an image,
  4772. it indicates that the image is a pattern tile rather than a single image.
  4773. @end deffn
  4774. @deffn ImageProperty @code{actual} w h
  4775. This property is the actual size of the image data. [Ever really used?]
  4776. @end deffn
  4777. @deffn ImageProperty @code{embed} name
  4778. This property specifies that another image, similar to the image family
  4779. named by @var{name}, is already embedded within the image, and so @i{Xconq}
  4780. need not superimpose such an image itself.  This may occur when an image
  4781. has a ``builtin'' side emblem, or is readily identifiable as belonging
  4782. to a particular side, and it would be redundant for @i{Xconq} to add an
  4783. emblem when displaying a unit.
  4784. @end deffn
  4785. @deffn ImageProperty @code{embed-at} x y w h
  4786. @end deffn
  4787. @deffn ImageProperty @code{mono} data...
  4788. This property indicates that the data represents a monochrome image.
  4789. @end deffn
  4790. @deffn ImageProperty @code{mask} data...
  4791. This property indicates that the data represents a mask.
  4792. @end deffn
  4793. @deffn ImageProperty @code{color} [properties] data...
  4794. This property indicates that the data represents a color image.
  4795. @end deffn
  4796. @deffn ColorImageProperty @code{pixel-size} n
  4797. This property is the number of bits used to encode each pixel.
  4798. @end deffn
  4799. @deffn ColorImageProperty @code{row-bytes} n
  4800. This property is the number of bytes in each row of the image.
  4801. @end deffn
  4802. @deffn ColorImageProperty @code{palette} [ name | (index r g b) ... ]
  4803. This property is the color palette that should be used with the image.
  4804. @end deffn
  4805. @deffn Form @code{palette} name (index r g b) ...
  4806. This form defines a palette with the given @var{name}.
  4807. @end deffn
  4808. @deffn Form @code{color} name r g b
  4809. This form names the color.
  4810. @end deffn
  4811. Note that for the purposes of stability and change tracking,
  4812. tools that generate image families use a more restricted format.
  4813. This format requires a separate imf form for each size of image,
  4814. the size is on the same line as the imf name, and each image/mask
  4815. is on a separate line, indented by 2. (See the existing @code{lib/*.imf}
  4816. files for further detail.)
  4817. @node Other Forms,  , Image Families, Reference Manual
  4818. @section Other Forms
  4819. GDL forms in this section are those that do not really fit anywhere
  4820. else.
  4821. @menu
  4822. * Default Display Style::
  4823. * The Random State::
  4824. * Debugging Support::                   
  4825. * Internal AI Data::            
  4826. @end menu
  4827. @deffn UnitTypeProperty @code{name-internal} str
  4828. Internally used type name.
  4829. @end deffn
  4830. @node Default Display Style, The Random State, , Other Forms
  4831. @subsection Default Display Style
  4832. The exact style of display depends on the user interface and
  4833. on user preferences,
  4834. but for some games, you may want to encourage a particular style
  4835. by making it be the default.
  4836. @deffn GlobalVariable @code{unseen-char} str
  4837. This variable is a string whose first character will be used to
  4838. represent unexplored terrain.
  4839. If the string consists of two characters, the second char will be
  4840. scattered throughout a field of the first char.
  4841. Defaults to @code{""}.
  4842. @end deffn
  4843. @deffn GlobalVariable @code{unseen-color} str
  4844. This variable is the name of a color that will be used to
  4845. represent unexplored terrain.
  4846. Defaults to @code{""}.
  4847. @end deffn
  4848. @deffn GlobalVariable @code{unseen-image-name} str
  4849. This variable is the name of an image that will be used to
  4850. represent unexplored terrain.
  4851. Defaults to @code{""}.
  4852. @end deffn
  4853. @deffn GlobalVariable @code{grid-color} str
  4854. This variable is the name of a color to use to draw the
  4855. cell-separating grid.
  4856. Defaults to @code{""}.
  4857. @end deffn
  4858. @node The Random State, Debugging Support, Default Display Style, Other Forms
  4859. @subsection The Random State
  4860. It is useful to be able to restart the random number generator
  4861. consistently.
  4862. @deffn GlobalVariable @code{random-state} n
  4863. This variable is the state of the random number generator.
  4864. If this is not used, then the initial state of the random number
  4865. generator will be set in a system-dependent way.
  4866. @end deffn
  4867. @node Debugging Support, Internal AI Data, The Random State, Other Forms
  4868. @subsection Debugging Support
  4869. @deffn Form @code{print} value
  4870. This form prints to a console (or whatever the interface provides)
  4871. the object @var{value}, in GDL syntax.
  4872. @end deffn
  4873. @node Internal AI Data,  , Debugging Support, Other Forms
  4874. @subsection Internal AI Data
  4875. These are normally computed and used internally by AIs.
  4876. They can be filled in by a game design, but the effects
  4877. are undocumented and will depend on the working of the AI
  4878. using these forms.
  4879. @deffn XXX @code{zz-fr}
  4880. @end deffn
  4881. @deffn XXX @code{zz-b}
  4882. @end deffn
  4883. @deffn XXX @code{zz-bb}
  4884. @end deffn
  4885. @deffn XXX @code{zz-transport}
  4886. @end deffn
  4887. @deffn XXX @code{zz-c}
  4888. @end deffn
  4889. @deffn XXX @code{zz-cm}
  4890. @end deffn
  4891. @deffn XXX @code{zz-cc}
  4892. @end deffn
  4893. @deffn XXX @code{zz-bw}
  4894. @end deffn
  4895. @deffn Table @code{zz-basic-hit-worth}
  4896. @end deffn
  4897. @deffn Table @code{zz-basic-capture-worth}
  4898. @end deffn
  4899. @deffn Table @code{zz-basic-transport-worth}
  4900. @end deffn
  4901.